Struct json::object::Object [] [src]

pub struct Object {
    // some fields omitted
}

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.

Methods

impl Object
[src]

fn new() -> Self

Create a new, empty instance of Object. Empty Object performs no allocation until a value is inserted into it.

fn with_capacity(capacity: usize) -> Self

Create a new Object with memory preallocated for capacity number of entries.

fn insert(&mut self, key: &str, value: JsonValue)

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.

fn get(&self, key: &str) -> Option<&JsonValue>

fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>

fn remove(&mut self, key: &str) -> Option<JsonValue>

Attempts to remove the value behind key, if successful will return the JsonValue stored behind the key.

fn len(&self) -> usize

fn is_empty(&self) -> bool

fn clear(&mut self)

Wipe the Object clear. The capacity will remain untouched.

fn iter(&self) -> Iter

fn iter_mut(&mut self) -> IterMut

Trait Implementations

impl Debug for Object
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Object
[src]

fn clone(&self) -> Self

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl PartialEq for Object
[src]

fn eq(&self, other: &Object) -> bool

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

This method tests for !=.

impl PartialEq<JsonValue> for Object
[src]

fn eq(&self, other: &JsonValue) -> bool

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

This method tests for !=.