Revert "Refine examples."

This reverts commit 146129279c.
This commit is contained in:
Stephen Chung
2022-01-16 22:50:39 +08:00
parent 146129279c
commit 5935a88958
6 changed files with 43 additions and 32 deletions

View File

@@ -1,6 +1,19 @@
#![cfg(feature = "serde")]
#![cfg(not(feature = "no_object"))]
#[cfg(any(not(feature = "serde"), feature = "no_object"))]
fn main() {
println!("This example requires the 'serde' feature to run.");
println!("Try: cargo run --features serde --example serde");
}
#[cfg(feature = "serde")]
#[cfg(not(feature = "no_object"))]
fn main() {
example::ser();
println!();
example::de();
}
#[cfg(feature = "serde")]
#[cfg(not(feature = "no_object"))]
mod example {
use rhai::serde::{from_dynamic, to_dynamic};
use rhai::{Dynamic, Engine, Map};
@@ -75,9 +88,3 @@ mod example {
println!("Deserialized to struct: {:#?}", x);
}
}
fn main() {
example::ser();
println!();
example::de();
}