Type Definition rbatis_sql::ops::Value
source · [−]pub type Value = Bson;
Expand description
proxy rbson::Document struct,support Deserializer, Serializer use Cow Optimize unnecessary clones This structure has a certain amount of computing power
Trait Implementations
sourceimpl AsProxy for Value
impl AsProxy for Value
fn i32(&self) -> i32
fn i64(&self) -> i64
fn u32(&self) -> u32
fn u64(&self) -> u64
fn f64(&self) -> f64
fn str(&self) -> &str
fn string(&self) -> String
fn cast_string(&self) -> String
fn cast_i64(&self) -> i64
fn cast_u64(&self) -> u64
fn cast_f64(&self) -> f64
fn bool(&self) -> bool
fn is_empty(&self) -> bool
fn is_null(&self) -> bool
fn is_array(&self) -> bool
fn array(&self) -> Option<&Array>
fn is_document(&self) -> bool
fn is_object(&self) -> bool
fn object(&self) -> Option<&Document>
fn bracket(&self) -> &str
sourceimpl<I> OpsIndex<I> for Value where
I: Index,
impl<I> OpsIndex<I> for Value where
I: Index,
sourcefn index(&self, index: I) -> &Value
fn index(&self, index: I) -> &Value
Index into a rbatis_sql::Value
using the syntax value[0]
or
value["k"]
.
Returns Value::Null
if the type of self
does not match the type of
the index, for example if the index is a string and self
is an array
or a number. Also returns Value::Null
if the given key does not exist
in the map or the given index is not within the bounds of the array.
For retrieving deeply nested values, you should have a look at the
Value::pointer
method.
Examples
let data = bson!({
"x": {
"y": ["z", "zz"]
}
});
assert_eq!(data["x"]["y"], bson!(["z", "zz"]));
assert_eq!(data["x"]["y"][0], bson!("z"));
assert_eq!(data["a"], bson!(null)); // returns null for undefined values
assert_eq!(data["a"]["b"], bson!(null)); // does not panic
sourceimpl<I> OpsIndexMut<I> for Value where
I: Index,
impl<I> OpsIndexMut<I> for Value where
I: Index,
sourcefn index_mut(&mut self, index: I) -> &mut Value
fn index_mut(&mut self, index: I) -> &mut Value
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);
sourceimpl PartialOrd<&'_ &'_ Bson> for &Value
impl PartialOrd<&'_ &'_ Bson> for &Value
sourcefn op_partial_cmp(&self, other: &&&Value) -> Option<Ordering>
fn op_partial_cmp(&self, other: &&&Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<&'_ &'_ Bson> for Value
impl PartialOrd<&'_ &'_ Bson> for Value
sourcefn op_partial_cmp(&self, other: &&&Value) -> Option<Ordering>
fn op_partial_cmp(&self, other: &&&Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<&'_ Bson> for &Value
impl PartialOrd<&'_ Bson> for &Value
sourcefn op_partial_cmp(&self, other: &&Value) -> Option<Ordering>
fn op_partial_cmp(&self, other: &&Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<&'_ Bson> for Value
impl PartialOrd<&'_ Bson> for Value
sourcefn op_partial_cmp(&self, other: &&Value) -> Option<Ordering>
fn op_partial_cmp(&self, other: &&Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<Bson> for Value
impl PartialOrd<Bson> for Value
sourcefn op_partial_cmp(&self, other: &Value) -> Option<Ordering>
fn op_partial_cmp(&self, other: &Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<Bson> for &Value
impl PartialOrd<Bson> for &Value
sourcefn op_partial_cmp(&self, other: &Value) -> Option<Ordering>
fn op_partial_cmp(&self, other: &Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<bool> for Value
impl PartialOrd<bool> for Value
sourcefn op_partial_cmp(&self, other: &bool) -> Option<Ordering>
fn op_partial_cmp(&self, other: &bool) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<bool> for &'a Value
impl<'a> PartialOrd<bool> for &'a Value
sourcefn op_partial_cmp(&self, other: &bool) -> Option<Ordering>
fn op_partial_cmp(&self, other: &bool) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<f32> for Value
impl PartialOrd<f32> for Value
sourcefn op_partial_cmp(&self, other: &f32) -> Option<Ordering>
fn op_partial_cmp(&self, other: &f32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<f32> for &'a Value
impl<'a> PartialOrd<f32> for &'a Value
sourcefn op_partial_cmp(&self, other: &f32) -> Option<Ordering>
fn op_partial_cmp(&self, other: &f32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<f64> for Value
impl PartialOrd<f64> for Value
sourcefn op_partial_cmp(&self, other: &f64) -> Option<Ordering>
fn op_partial_cmp(&self, other: &f64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<f64> for &'a Value
impl<'a> PartialOrd<f64> for &'a Value
sourcefn op_partial_cmp(&self, other: &f64) -> Option<Ordering>
fn op_partial_cmp(&self, other: &f64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<i16> for Value
impl PartialOrd<i16> for Value
sourcefn op_partial_cmp(&self, other: &i16) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<i16> for &'a Value
impl<'a> PartialOrd<i16> for &'a Value
sourcefn op_partial_cmp(&self, other: &i16) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<i32> for Value
impl PartialOrd<i32> for Value
sourcefn op_partial_cmp(&self, other: &i32) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<i32> for &'a Value
impl<'a> PartialOrd<i32> for &'a Value
sourcefn op_partial_cmp(&self, other: &i32) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<i64> for Value
impl PartialOrd<i64> for Value
sourcefn op_partial_cmp(&self, other: &i64) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<i64> for &'a Value
impl<'a> PartialOrd<i64> for &'a Value
sourcefn op_partial_cmp(&self, other: &i64) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<i8> for Value
impl PartialOrd<i8> for Value
sourcefn op_partial_cmp(&self, other: &i8) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i8) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<i8> for &'a Value
impl<'a> PartialOrd<i8> for &'a Value
sourcefn op_partial_cmp(&self, other: &i8) -> Option<Ordering>
fn op_partial_cmp(&self, other: &i8) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<isize> for Value
impl PartialOrd<isize> for Value
sourcefn op_partial_cmp(&self, other: &isize) -> Option<Ordering>
fn op_partial_cmp(&self, other: &isize) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<isize> for &'a Value
impl<'a> PartialOrd<isize> for &'a Value
sourcefn op_partial_cmp(&self, other: &isize) -> Option<Ordering>
fn op_partial_cmp(&self, other: &isize) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<u16> for Value
impl PartialOrd<u16> for Value
sourcefn op_partial_cmp(&self, other: &u16) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<u16> for &'a Value
impl<'a> PartialOrd<u16> for &'a Value
sourcefn op_partial_cmp(&self, other: &u16) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<u32> for Value
impl PartialOrd<u32> for Value
sourcefn op_partial_cmp(&self, other: &u32) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<u32> for &'a Value
impl<'a> PartialOrd<u32> for &'a Value
sourcefn op_partial_cmp(&self, other: &u32) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<u64> for Value
impl PartialOrd<u64> for Value
sourcefn op_partial_cmp(&self, other: &u64) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<u64> for &'a Value
impl<'a> PartialOrd<u64> for &'a Value
sourcefn op_partial_cmp(&self, other: &u64) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<u8> for Value
impl PartialOrd<u8> for Value
sourcefn op_partial_cmp(&self, other: &u8) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u8) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> PartialOrd<u8> for &'a Value
impl<'a> PartialOrd<u8> for &'a Value
sourcefn op_partial_cmp(&self, other: &u8) -> Option<Ordering>
fn op_partial_cmp(&self, other: &u8) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn op_lt(&self, other: &Rhs) -> bool
fn op_lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn op_le(&self, other: &Rhs) -> bool
fn op_le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more