Struct over::obj::Obj
[−]
[src]
pub struct Obj { /* fields omitted */ }
Obj
struct.
Methods
impl Obj
[src]
fn new() -> Obj
[src]
Returns a new empty Obj
.
fn from_file(path: &str) -> OverResult<Obj>
[src]
Returns a new Obj
loaded from a file.
fn write_to_file(&self, path: &str) -> OverResult<()>
[src]
Writes this Obj
to given file in .over
representation.
Notes
Note that the fields of the Obj
will be output in an unpredictable order.
Also note that shorthand in the original file, including variables and file includes,
is not preserved when parsing the file, and will not appear when writing to another file.
fn write_str(&self) -> String
[src]
fn to_map(&self) -> HashMap<String, Value>
[src]
Returns the map of values in this Arr
. Parent field/value pairs are excluded.
fn with_each<F>(&self, f: F) where
F: FnMut(&String, &Value),
[src]
F: FnMut(&String, &Value),
Iterates over each (String, Value)
pair in self
, applying f
.
fn len(&self) -> usize
[src]
Returns the number of fields for this Obj
(children/parents not included).
fn is_empty(&self) -> bool
[src]
Returns whether this Obj
is empty.
fn ptr_eq(&self, other: &Self) -> bool
[src]
Returns whether self
and other
point to the same data.
fn contains(&self, field: &str) -> bool
[src]
Returns true iff the Obj
contains field
.
fn remove(&mut self, field: &str) -> Option<Value>
[src]
Removes a field and its associated value from the Obj
.
fn clear(&mut self)
[src]
Clears all fields from the Obj
.
fn get(&self, field: &str) -> Option<Value>
[src]
Gets the Value
associated with field
.
fn get_with_source(&self, field: &str) -> Option<(Value, Obj)>
[src]
Gets the Value
associated with field
and the Obj
where it was found (either self
or
one of its parents).
fn get_bool(&self, field: &str) -> OverResult<bool>
[src]
fn get_int(&self, field: &str) -> OverResult<BigInt>
[src]
fn get_frac(&self, field: &str) -> OverResult<BigRational>
[src]
fn get_char(&self, field: &str) -> OverResult<char>
[src]
fn get_str(&self, field: &str) -> OverResult<String>
[src]
fn get_arr(&self, field: &str) -> OverResult<Arr>
[src]
fn get_tup(&self, field: &str) -> OverResult<Tup>
[src]
fn get_obj(&self, field: &str) -> OverResult<Obj>
[src]
fn set(&mut self, field: &str, value: Value)
[src]
Sets the Value
for field
.
fn has_parent(&self) -> bool
[src]
Returns whether this Obj
has a parent.
fn get_parent(&self) -> Option<Obj>
[src]
Returns the parent for this Obj
.
fn set_parent(&mut self, parent: &Obj) -> OverResult<()>
[src]
Sets the parent for this Obj
.
Circular references in parents are not allowed.
Trait Implementations
impl Clone for Obj
[src]
fn clone(&self) -> Obj
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Obj
[src]
impl Default for Obj
[src]
impl Display for Obj
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl FromStr for Obj
[src]
type Err = OverError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
Parses a string s
to return a value of this type. Read more
impl PartialEq for Obj
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.