pub enum Object {
Dict(Vec<Object>),
Pair(Pair),
Str(String),
ZStr(String),
Int(i32),
}Expand description
Lron Object
Variants§
Implementations§
Source§impl Object
impl Object
Sourcepub fn from_string(s: &str) -> Result<Object, ParseError<LineCol>>
pub fn from_string(s: &str) -> Result<Object, ParseError<LineCol>>
Create an object from a string
Examples found in repository?
examples/lron_dump.rs (line 23)
17fn dump_lron(filename: &str) -> std::io::Result<()> {
18 let mut file = File::open(filename).expect("Unknown file");
19
20 let mut buffer = String::new();
21 file.read_to_string(&mut buffer)?;
22
23 let o = lrcat::lron::Object::from_string(&buffer);
24 match o {
25 Ok(ref o) => {
26 println!("Result: {:?}", o);
27 }
28 Err(e) => println!("Error parsing file {}: {:?}", filename, e),
29 }
30 Ok(())
31}Trait Implementations§
impl StructuralPartialEq for Object
Auto Trait Implementations§
impl Freeze for Object
impl RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl UnwindSafe for Object
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more