diff --git a/README.md b/README.md index 79ceef7..dcc2984 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ type that implements it. This trait can be derived if the `derive` **feature** i ```rust -use rusty_value::RustyValue; +use rusty_value::{RustyValue, Value}; #[derive(RustyValue)] struct MyStruct { @@ -22,10 +22,26 @@ struct MyStruct { } fn main() { - MyStruct { + let value = MyStruct { foo: "Hello World".to_string(), bar: 12, }.into_rusty_value(); + + match value { + Value::Primitive(p) => match p { + rusty_value::Primitive::Integer(_) => println!("is an integer"), + rusty_value::Primitive::Float(_) => println!("is a float"), + rusty_value::Primitive::String(_) => println!("is a string"), + rusty_value::Primitive::OsString(_) => println!("is a os string"), + rusty_value::Primitive::Char(_) => println!("is a char"), + rusty_value::Primitive::Bool(_) => println!("is a boolean"), + }, + Value::Struct(s) => println!("is a struct with name {}", s.name), + Value::Enum(e) => println!("is an enum with name {} of variant {}", e.name, e.variant), + Value::Map(_) => println!("is a map"), + Value::List(_) => println!("is a list"), + Value::None => println!("is none"), + } } ```