pub struct DomainForm {
pub name: String,
pub fields: Vec<(String, DomainValue)>,
pub positional: Vec<DomainValue>,
}Expand description
A parsed #(name ...) form: a name, keyed fields, and positional values.
Fields§
§name: StringThe form name.
fields: Vec<(String, DomainValue)>Keyed key=value fields, in order.
positional: Vec<DomainValue>Positional (un-keyed) values, in order.
Implementations§
Source§impl DomainForm
impl DomainForm
Sourcepub fn field(&self, key: &str) -> Option<&DomainValue>
pub fn field(&self, key: &str) -> Option<&DomainValue>
The value of keyed field key, if present.
Sourcepub fn atom(&self, key: &str) -> Result<&str, DomainFormError>
pub fn atom(&self, key: &str) -> Result<&str, DomainFormError>
The atom string of keyed field key.
Sourcepub fn string(&self, key: &str) -> Result<&str, DomainFormError>
pub fn string(&self, key: &str) -> Result<&str, DomainFormError>
The string of keyed field key.
Sourcepub fn list(&self, key: &str) -> Result<&[DomainValue], DomainFormError>
pub fn list(&self, key: &str) -> Result<&[DomainValue], DomainFormError>
The list items of keyed field key.
Sourcepub fn form(&self, key: &str) -> Result<&DomainForm, DomainFormError>
pub fn form(&self, key: &str) -> Result<&DomainForm, DomainFormError>
The nested form of keyed field key.
Sourcepub fn field_atom_or_string(&self, name: &str) -> Result<&str, DomainFormError>
pub fn field_atom_or_string(&self, name: &str) -> Result<&str, DomainFormError>
The atom or string text of keyed field key.
Accepts either a bare atom or a quoted string, returning the underlying
text in both cases (the reverse of the #(...) writer, which renders a
symbol as an atom and a string with quotes).
Sourcepub fn field_text(&self, name: &str) -> Result<String, DomainFormError>
pub fn field_text(&self, name: &str) -> Result<String, DomainFormError>
The rendered render_text form of keyed
field name.
Errors with MissingField when the
field is absent; any present value renders (an atom to its text, a
string to its quoted form, a list or nested form to its #(...)/[...]
text).
Trait Implementations§
Source§impl Clone for DomainForm
impl Clone for DomainForm
Source§fn clone(&self) -> DomainForm
fn clone(&self) -> DomainForm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DomainForm
impl Debug for DomainForm
Source§impl PartialEq for DomainForm
impl PartialEq for DomainForm
Source§fn eq(&self, other: &DomainForm) -> bool
fn eq(&self, other: &DomainForm) -> bool
self and other values to be equal, and is used by ==.