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

pub struct Object { /* 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]

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.

Important traits for Iter<'a>

Important traits for IterMut<'a>

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.

Trait Implementations

impl Clone for Object
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl From<Object> for JsonValue
[src]

Performs the conversion.

impl PartialEq<Object> for JsonValue
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<Object> for &'a JsonValue
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<JsonValue> for Object
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<Object> for Object
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for Object
[src]

Formats the value using the given formatter. Read more

impl<'a> Index<&'a str> for Object
[src]

Implements indexing by &str to easily access object members:

Example

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.

impl Index<String> for Object
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<'a> Index<&'a String> for Object
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<'a> IndexMut<&'a str> for Object
[src]

Implements mutable indexing by &str to easily modify object members:

Example

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.

impl IndexMut<String> for Object
[src]

Performs the mutable indexing (container[index]) operation.

impl<'a> IndexMut<&'a String> for Object
[src]

Performs the mutable indexing (container[index]) operation.

Auto Trait Implementations

impl Send for Object

impl Sync for Object

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

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

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more