pub enum DomainValue {
Form(DomainForm),
List(Vec<DomainValue>),
String(String),
Atom(String),
}Expand description
A parsed domain-form value.
Variants§
Form(DomainForm)
A nested #(...) form.
List(Vec<DomainValue>)
A [...] list.
String(String)
A "..." string.
Atom(String)
A bare atom (number, identifier, 4/4, …).
Implementations§
Source§impl DomainValue
impl DomainValue
Sourcepub fn as_form(&self) -> Result<&DomainForm, DomainFormError>
pub fn as_form(&self) -> Result<&DomainForm, DomainFormError>
The nested form, if this value is a #(...) form.
Errors with WrongValueKind for a
list, string, or atom.
Sourcepub fn atom_or_string(&self) -> Result<&str, DomainFormError>
pub fn atom_or_string(&self) -> Result<&str, DomainFormError>
The text of this value when it is a bare atom or a quoted string.
Errors with WrongValueKind for a
list or nested form.
Sourcepub fn render_text(&self) -> String
pub fn render_text(&self) -> String
Renders this value back to its ASCII #(...) source text: an atom to
its literal text, a string to its escaped quoted form, a list to
[a,b,...], and a nested form via format_domain_form.
Round-trips through parse_domain_form for a top-level form value.
Trait Implementations§
Source§impl Clone for DomainValue
impl Clone for DomainValue
Source§fn clone(&self) -> DomainValue
fn clone(&self) -> DomainValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DomainValue
impl Debug for DomainValue
Source§impl PartialEq for DomainValue
impl PartialEq for DomainValue
Source§fn eq(&self, other: &DomainValue) -> bool
fn eq(&self, other: &DomainValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DomainValue
Auto Trait Implementations§
impl Freeze for DomainValue
impl RefUnwindSafe for DomainValue
impl Send for DomainValue
impl Sync for DomainValue
impl Unpin for DomainValue
impl UnsafeUnpin for DomainValue
impl UnwindSafe for DomainValue
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