Enum bson::Bson [−][src]
pub enum Bson {
FloatingPoint(f64),
String(String),
Array(Array),
Document(Document),
Boolean(bool),
Null,
RegExp(String, String),
JavaScriptCode(String),
JavaScriptCodeWithScope(String, Document),
I32(i32),
I64(i64),
TimeStamp(i64),
Binary(BinarySubtype, Vec<u8>),
ObjectId(ObjectId),
UtcDatetime(DateTime<Utc>),
Symbol(String),
}Possible BSON value types.
Variants
FloatingPoint(f64)64-bit binary floating point
String(String)UTF-8 string
Array(Array)Array
Document(Document)Embedded document
Boolean(bool)Boolean value
NullNull value
RegExp(String, String)Regular expression - The first cstring is the regex pattern, the second is the regex options string. Options are identified by characters, which must be stored in alphabetical order. Valid options are 'i' for case insensitive matching, 'm' for multiline matching, 'x' for verbose mode, 'l' to make \w, \W, etc. locale dependent, 's' for dotall mode ('.' matches everything), and 'u' to make \w, \W, etc. match unicode.
JavaScriptCode(String)JavaScript code
JavaScriptCodeWithScope(String, Document)JavaScript code w/ scope
I32(i32)32-bit integer
I64(i64)64-bit integer
TimeStamp(i64)Timestamp
Binary(BinarySubtype, Vec<u8>)Binary data
ObjectId(ObjectId)UtcDatetime(DateTime<Utc>)UTC datetime
Symbol(String)Symbol (Deprecated)
Methods
impl Bson[src]
impl Bsonpub fn element_type(&self) -> ElementType[src]
pub fn element_type(&self) -> ElementTypeGet the ElementType of this value.
pub fn to_json(&self) -> Value[src]
pub fn to_json(&self) -> Value: use bson.clone().into() instead
Clones the bson and returns the representative serde_json Value. The json will be in extended JSON format.
pub fn into_json(self) -> Value[src]
pub fn into_json(self) -> Value: use bson.into() instead
Consumes the bson and returns the representative serde_json Value. The json will be in extended JSON format.
pub fn from_json(val: Value) -> Bson[src]
pub fn from_json(val: Value) -> Bson: use json.into() instead
Consumes the serde_json Value and returns the representative bson. The json should be in extended JSON format.
impl Bson[src]
impl BsonValue helpers
pub fn as_f64(&self) -> Option<f64>[src]
pub fn as_f64(&self) -> Option<f64>If Bson is FloatingPoint, return its value. Returns None otherwise
pub fn as_str(&self) -> Option<&str>[src]
pub fn as_str(&self) -> Option<&str>If Bson is String, return its value. Returns None otherwise
pub fn as_array(&self) -> Option<&Array>[src]
pub fn as_array(&self) -> Option<&Array>If Bson is Array, return its value. Returns None otherwise
pub fn as_document(&self) -> Option<&Document>[src]
pub fn as_document(&self) -> Option<&Document>If Bson is Document, return its value. Returns None otherwise
pub fn as_bool(&self) -> Option<bool>[src]
pub fn as_bool(&self) -> Option<bool>If Bson is Boolean, return its value. Returns None otherwise
pub fn as_i32(&self) -> Option<i32>[src]
pub fn as_i32(&self) -> Option<i32>If Bson is I32, return its value. Returns None otherwise
pub fn as_i64(&self) -> Option<i64>[src]
pub fn as_i64(&self) -> Option<i64>If Bson is I64, return its value. Returns None otherwise
pub fn as_object_id(&self) -> Option<&ObjectId>[src]
pub fn as_object_id(&self) -> Option<&ObjectId>If Bson is Objectid, return its value. Returns None otherwise
pub fn as_utc_date_time(&self) -> Option<&DateTime<Utc>>[src]
pub fn as_utc_date_time(&self) -> Option<&DateTime<Utc>>If Bson is UtcDateTime, return its value. Returns None otherwise
pub fn as_symbol(&self) -> Option<&str>[src]
pub fn as_symbol(&self) -> Option<&str>If Bson is Symbol, return its value. Returns None otherwise
pub fn as_timestamp(&self) -> Option<i64>[src]
pub fn as_timestamp(&self) -> Option<i64>If Bson is TimeStamp, return its value. Returns None otherwise
pub fn as_null(&self) -> Option<()>[src]
pub fn as_null(&self) -> Option<()>If Bson is Null, return its value. Returns None otherwise
Trait Implementations
impl Clone for Bson[src]
impl Clone for Bsonfn clone(&self) -> Bson[src]
fn clone(&self) -> BsonReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl PartialEq for Bson[src]
impl PartialEq for Bsonfn eq(&self, other: &Bson) -> bool[src]
fn eq(&self, other: &Bson) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Bson) -> bool[src]
fn ne(&self, other: &Bson) -> boolThis method tests for !=.
impl Default for Bson[src]
impl Default for Bsonimpl Debug for Bson[src]
impl Debug for Bsonfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Display for Bson[src]
impl Display for Bsonfn fmt(&self, fmt: &mut Formatter) -> Result[src]
fn fmt(&self, fmt: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl From<f32> for Bson[src]
impl From<f32> for Bsonimpl From<f64> for Bson[src]
impl From<f64> for Bsonimpl<'a> From<&'a str> for Bson[src]
impl<'a> From<&'a str> for Bsonimpl From<String> for Bson[src]
impl From<String> for Bsonimpl<'a> From<&'a String> for Bson[src]
impl<'a> From<&'a String> for Bsonimpl From<Array> for Bson[src]
impl From<Array> for Bsonimpl From<Document> for Bson[src]
impl From<Document> for Bsonimpl From<bool> for Bson[src]
impl From<bool> for Bsonimpl From<(String, String)> for Bson[src]
impl From<(String, String)> for Bsonimpl From<(String, Document)> for Bson[src]
impl From<(String, Document)> for Bsonimpl From<(BinarySubtype, Vec<u8>)> for Bson[src]
impl From<(BinarySubtype, Vec<u8>)> for Bsonimpl From<i32> for Bson[src]
impl From<i32> for Bsonimpl From<i64> for Bson[src]
impl From<i64> for Bsonimpl From<u32> for Bson[src]
impl From<u32> for Bsonimpl From<u64> for Bson[src]
impl From<u64> for Bsonimpl From<[u8; 12]> for Bson[src]
impl From<[u8; 12]> for Bsonimpl From<ObjectId> for Bson[src]
impl From<ObjectId> for Bsonimpl From<DateTime<Utc>> for Bson[src]
impl From<DateTime<Utc>> for Bsonimpl From<Value> for Bson[src]
impl From<Value> for Bsonimpl Into<Value> for Bson[src]
impl Into<Value> for Bsonimpl<'de> Deserialize<'de> for Bson[src]
impl<'de> Deserialize<'de> for Bsonfn deserialize<D>(deserializer: D) -> Result<Bson, D::Error> where
D: Deserializer<'de>, [src]
fn deserialize<D>(deserializer: D) -> Result<Bson, D::Error> where
D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. Read more
impl Serialize for Bson[src]
impl Serialize for Bson