Explorar o código

add simple test example

Dastan-glitch %!s(int64=3) %!d(string=hai) anos
pai
achega
22af89a66d
Modificáronse 2 ficheiros con 16 adicións e 0 borrados
  1. 4 0
      Cargo.toml
  2. 12 0
      example/derive_macro_example.rs

+ 4 - 0
Cargo.toml

@@ -329,6 +329,10 @@ name = "dao"
 path = "example/dao-schema-rs/dao.rs"
 required-features = ["crypto"]
 
+[[example]]
+name = "test"
+path = "example/derive_macro_example.rs"
+
 #[[example]]
 #name = "lead"
 #path = "example/lead.rs"

+ 12 - 0
example/derive_macro_example.rs

@@ -0,0 +1,12 @@
+use darkfi::util::serial::SerialEncodable;
+
+#[derive(Debug, SerialEncodable)]
+struct Test {
+    one: u64,
+    two: u64,
+}
+
+fn main() {
+    let test = Test { one: 1, two: 2 };
+    println!("Test: {:?}", test);
+}