pub struct Object { /* fields omitted */ }
Expand description
A binary tree implementation of a string -> JsonValue
map. You normally don’t
have to interact with instances of Object
, much more likely you will be
using the JsonValue::Object
variant, which wraps around this struct.
Create a new, empty instance of Object
. Empty Object
performs no
allocation until a value is inserted into it.
Create a new Object
with memory preallocated for capacity
number
of entries.
Insert a new entry, or override an existing one. Note that key
has
to be a &str
slice and not an owned String
. The internals of
Object
will handle the heap allocation of the key if needed for
better performance.
👎 Deprecated since 0.11.11:
Was only meant for internal use
Attempts to remove the value behind key
, if successful
will return the JsonValue
stored behind the key
.
Wipe the Object
clear. The capacity will remain untouched.
Prints out the value as JSON string.
Pretty prints out the value as JSON string. Takes an argument that’s
number of spaces to indent new blocks with.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
Implements indexing by &str
to easily access object members:
let value = object!{
"foo" => "bar"
};
if let JsonValue::Object(object) = value {
assert!(object["foo"] == "bar");
}
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
Implements mutable indexing by &str
to easily modify object members:
let value = object!{};
if let JsonValue::Object(mut object) = value {
object["foo"] = 42.into();
assert!(object["foo"] == 42);
}
Performs the mutable indexing (container[index]
) operation. Read more
Performs the mutable indexing (container[index]
) operation. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.