Trait rbatis::OpsIndexMut[][src]

pub trait OpsIndexMut<Idx>: OpsIndex<Idx> where
    Idx: ?Sized
{ fn index_mut(&mut self, index: Idx) -> &mut Self::Output; }

Required methods

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

Panics

May panic if the index is out of bounds.

Implementations on Foreign Types

Write into a rbatis_sql::Value using the syntax value[0] = ... or value["k"] = ....

If the index is a number, the value must be an array of length bigger than the index. Indexing into a value that is not an array or an array that is too small will panic.

If the index is a string, the value must be an object or null which is treated like an empty object. If the key is not already present in the object, it will be inserted with a value of null. Indexing into a value that is neither an object nor null will panic.

Examples
let mut data = bson!({ "x": 0 });

// replace an existing key
data["x"] = bson!(1);

// insert a new key
data["y"] = bson!([false, false, false]);

// replace an array value
data["y"][0] = bson!(true);

// inserted a deeply nested key
data["a"]["b"]["c"]["d"] = bson!(true);

println!("{}", data);

Implementors