Forráskód Böngészése

add simple test example

Dastan-glitch 3 éve
szülő
commit
22af89a66d
2 módosított fájl, 16 hozzáadás és 0 törlés
  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"
 path = "example/dao-schema-rs/dao.rs"
 required-features = ["crypto"]
 required-features = ["crypto"]
 
 
+[[example]]
+name = "test"
+path = "example/derive_macro_example.rs"
+
 #[[example]]
 #[[example]]
 #name = "lead"
 #name = "lead"
 #path = "example/lead.rs"
 #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);
+}