finish implementing the modular object format #3
1 changed files with 4 additions and 4 deletions
|
|
@ -20,10 +20,10 @@ fn main() -> Result<(), String> {
|
||||||
let transform_destination = "meta/number:value";
|
let transform_destination = "meta/number:value";
|
||||||
|
|
||||||
// this creates a new object instance
|
// this creates a new object instance
|
||||||
let some_object = ObjectInstance::from_template(object_type, input)?;
|
let some_object = ObjectInstance::from_object_type(object_type, input)?;
|
||||||
|
|
||||||
println!("this is an object:");
|
println!("this is an object:");
|
||||||
println!("{:?}", some_object);
|
println!("{:#?}", some_object);
|
||||||
println!("");
|
println!("");
|
||||||
|
|
||||||
// this runs a function on it to calculate other properties
|
// this runs a function on it to calculate other properties
|
||||||
|
|
@ -36,13 +36,13 @@ fn main() -> Result<(), String> {
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("this is the same object with data:");
|
println!("this is the same object with data:");
|
||||||
println!("{:?}", some_object_with_data);
|
println!("{:#?}", some_object_with_data);
|
||||||
println!("");
|
println!("");
|
||||||
|
|
||||||
let transformed = ObjectInstance::transform(&some_object_with_data, transform_source, transform_destination)?;
|
let transformed = ObjectInstance::transform(&some_object_with_data, transform_source, transform_destination)?;
|
||||||
|
|
||||||
println!("this is what happens when we transform the {} property into a new {}:", transform_source, transform_destination);
|
println!("this is what happens when we transform the {} property into a new {}:", transform_source, transform_destination);
|
||||||
println!("{:?}", transformed);
|
println!("{:#?}", transformed);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue