Skip to content

Commit ddc8a41

Browse files
authored
docs(examples): update docs for new introduced proc-macros (#139)
* docs(examples): update docs for new introduced proc-macros * chore(zink): more details for the codegen library * bump(zink): 0.1.4
1 parent b8d6dd4 commit ddc8a41

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "0.1.3"
2+
version = "0.1.4"
33
authors = ["clearloop"]
44
edition = "2021"
55
license = "GPL-3.0-only"
@@ -47,13 +47,13 @@ wasmparser = "0.107.0"
4747
wat = "1.0.66"
4848

4949
# Local Dependencies.
50-
zinkup = { path = "cli", version = "=0.1.3" }
50+
zinkup = { path = "cli", version = "=0.1.4" }
5151
opcodes = { package = "evm-opcodes", path = "codegen/opcodes", version = "=0.0.3", features = ["data"] }
52-
zingen = { path = "codegen", version = "=0.1.3" }
53-
zinkc = { path = "compiler", version = "=0.1.3" }
54-
zink = { path = "zink", version = "=0.1.3" }
55-
zink-codegen = { path = "zink/codegen", version = "=0.1.3" }
56-
zint = { path = "zint", version = "=0.1.3" }
52+
zingen = { path = "codegen", version = "=0.1.4" }
53+
zinkc = { path = "compiler", version = "=0.1.4" }
54+
zink = { path = "zink", version = "=0.1.4" }
55+
zink-codegen = { path = "zink/codegen", version = "=0.1.4" }
56+
zint = { path = "zint", version = "=0.1.4" }
5757

5858
[profile]
5959
dev = { panic = "abort"}

Conta.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ packages = [
22
"zingen",
33
"zint",
44
"zinkc",
5+
"zink-codegen",
56
"zink",
67
"zinkup"
78
]

cli/src/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct Compile {
1313
/// The path of the wasm file.
1414
#[clap(value_name = "INPUT")]
1515
input: PathBuf,
16-
/// Write output to <filename>
16+
/// Write output to \<filename\>
1717
#[clap(short, long)]
1818
output: Option<PathBuf>,
1919
}

codegen/src/visitor/control.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl CodeGen {
8787
/// The select instruction selects one of its first two operands based
8888
/// on whether its third oprand is zero or not.
8989
///
90-
/// STACK: [val1, val2, cond] -> [val1] if cond is non-zero, [val2] otherwise.
90+
/// STACK: [val1, val2, cond] -> \[val1\] if cond is non-zero, \[val2\] otherwise.
9191
pub fn _select(&mut self) -> Result<()> {
9292
tracing::trace!("select");
9393
let func = Func::Select;

docs/examples/log.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@ extern crate zink;
1111
use zink::Event;
1212

1313
/// A `Ping` event.
14-
///
15-
/// TODO: generate this with proc-macro.
14+
#[derive(Event)]
1615
struct Ping;
1716

18-
/// TODO: generate this with proc-macro.
19-
impl Event for Ping {
20-
const NAME: &'static [u8] = b"Ping";
21-
}
22-
2317
#[no_mangle]
2418
pub extern "C" fn log1() {
2519
Ping.log1(b"pong");

docs/examples/storage.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
# Storage
22

33
```rust
4-
use zink::storage::{sload, sstore};
5-
6-
/// TODO: generate this storage interface with proc macro.
7-
struct Counter;
8-
9-
// The number `0` in this struct is for the storage key,
10-
// it will be convreted to `0x000..0000`.
11-
impl Counter {
12-
fn get() -> i64 {
13-
unsafe { sload(0) }
14-
}
15-
16-
fn set(value: i64) {
17-
unsafe { sstore(0, value) }
18-
}
19-
}
4+
// for the panic handler.
5+
#[cfg(not(test))]
6+
extern crate zink;
7+
8+
use zink::Storage;
9+
10+
/// It gets expanded to 'Counter' struct
11+
/// that implements zink::Storage trait
12+
/// (::set and ::get)
13+
///
14+
/// Storage key is taken based on macro order
15+
/// (e.g this macro is first and only in this project,
16+
/// so it will take 0x0 contract storage key)
17+
#[zink::storage]
18+
pub type Counter = i32;
2019

2120
/// Set value to storage and get it
2221
#[no_mangle]

zink/codegen/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
[package]
22
name = "zink-codegen"
3-
version = "0.1.3"
4-
edition = "2021"
3+
description = "Code generation for zink APIs."
4+
documentation = "https://docs.rs/zink-codegen"
5+
version.workspace = true
6+
authors.workspace = true
7+
edition.workspace = true
8+
license.workspace = true
9+
homepage.workspace = true
10+
repository.workspace = true
511

612
[lib]
713
proc-macro = true

0 commit comments

Comments
 (0)