Enum Sexpr Copy item path Source pub enum Sexpr<'src> {
List(Sexprs <'src>),
Group(Sexprs <'src>),
String(Cow <'src, [u8 ]>),
Atom(&'src [u8 ]),
Comment(&'src [u8 ]),
}Expand description A single node of the tree. The Atom and String variants
reference the input slice. For an owned version have a look at OwnedSexpr .
§ Display
Sexpr implements the Display trait for serializing to strings. By default, the output
will try to minimize the amount of spaces used and the resulting output will be on one line.
Enabling the formatter’s alternate flag using #, causes the output to be human-friendly /
pretty-printed. Setting the precision with . additionally allows to specify the number of
spaces used for indentation (2 by default).
For example:
let sexpr = rsexpr::from_slice(b"[ a b c ]" ).unwrap();
assert_eq! (format! ("{sexpr}" ), "[a b c]" );
assert_eq! (format! ("{sexpr:#}" ), "[
a
b
c
]" );
assert_eq! (format! ("{sexpr:#.4}" ), "[
a
b
c
]" );
A list of Sexpr s surrounded by parentheses (, )
A list of Sexpr s surrounded by brackets [, ]
A sequence of bytes surrounded by quotes "
A sequence of bytes not including whitespace, parens, and quotes
Available on crate feature comments only.
A line comment, including the leading ;
Returns the contained List value, consuming self.
§ Panics
Panics if self is not List .
Returns the contained List value by reference.
§ Panics
Panics if self is not List .
Returns the contained Group value, consuming self.
§ Panics
Panics if self is not Group .
Returns the contained Group value by reference.
§ Panics
Panics if self is not Group .
Returns the contained String value, consuming self.
§ Panics
Panics if self is not String .
Returns the contained String value by reference.
§ Panics
Panics if self is not String .
Returns the contained Atom value, consuming self.
§ Panics
Panics if self is not Atom .
Returns the contained Atom value by reference.
§ Panics
Panics if self is not Atom .
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Formats the value using the given formatter.
Read more Converts to this type from the input type.
Converts to this type from the input type.
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more Converts the given value to a
String.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.