Enum bson2::Bson [−][src]
pub enum Bson {
Show 23 variants
Double(f64),
String(String),
Array(Array),
Document(Document),
Boolean(bool),
Null,
RegularExpression(Regex),
JavaScriptCode(String),
JavaScriptCodeWithScope(JavaScriptCodeWithScope),
Int32(i32),
Int64(i64),
UInt32(u32),
UInt64(u64),
Timestamp(Timestamp),
Binary(Binary),
ObjectId(ObjectId),
DateTime(DateTime),
Symbol(String),
Decimal128(Decimal128),
Undefined,
MaxKey,
MinKey,
DbPointer(DbPointer),
}
Expand description
Possible BSON value types.
Variants
Double(f64)
64-bit binary floating point
Tuple Fields of Double
0: f64
String(String)
UTF-8 string
Tuple Fields of String
0: String
Array(Array)
Array
Tuple Fields of Array
0: Array
Document(Document)
Embedded document
Tuple Fields of Document
0: Document
Boolean(bool)
Boolean value
Tuple Fields of Boolean
0: bool
Null value
RegularExpression(Regex)
Regular expression
Tuple Fields of RegularExpression
0: Regex
JavaScriptCode(String)
JavaScript code
Tuple Fields of JavaScriptCode
0: String
JavaScriptCodeWithScope(JavaScriptCodeWithScope)
JavaScript code w/ scope
Tuple Fields of JavaScriptCodeWithScope
Int32(i32)
32-bit signed integer
Tuple Fields of Int32
0: i32
Int64(i64)
64-bit signed integer
Tuple Fields of Int64
0: i64
UInt32(u32)
32-bit signed integer
Tuple Fields of UInt32
0: u32
UInt64(u64)
64-bit signed integer
Tuple Fields of UInt64
0: u64
Timestamp(Timestamp)
Timestamp
Tuple Fields of Timestamp
0: Timestamp
Binary(Binary)
Binary data
Tuple Fields of Binary
0: Binary
ObjectId(ObjectId)
Tuple Fields of ObjectId
0: ObjectId
DateTime(DateTime)
UTC datetime
Tuple Fields of DateTime
0: DateTime
Symbol(String)
Symbol (Deprecated)
Tuple Fields of Symbol
0: String
Decimal128(Decimal128)
Tuple Fields of Decimal128
0: Decimal128
Undefined value (Deprecated)
Max key
Min key
DbPointer(DbPointer)
DBPointer (Deprecated)
Tuple Fields of DbPointer
0: DbPointer
Implementations
Converts the Bson value into its relaxed extended JSON representation.
Note: If this method is called on a case which contains a Decimal128
value, it will panic.
Converts the Bson value into its canonical extended JSON representation.
Note: extended json encoding for Decimal128
values is not supported. If this method is
called on a case which contains a Decimal128
value, it will panic.
Get the ElementType
of this value.
Value helpers
If Bson
is Double
, return its value as an f64
. Returns None
otherwise
If Bson
is String
, return its value as a &str
. Returns None
otherwise
If Bson
is String
, return a mutable reference to its value as a str
. Returns None
otherwise
If Bson
is Array
, return its value. Returns None
otherwise
If Bson
is Array
, return a mutable reference to its value. Returns None
otherwise
If Bson
is Document
, return its value. Returns None
otherwise
If Bson
is Document
, return a mutable reference to its value. Returns None
otherwise
If Bson
is Objectid
, return its value. Returns None
otherwise
If Bson
is Objectid
, return a mutable reference to its value. Returns None
otherwise
If Bson
is DateTime
, return its value. Returns None
otherwise
If Bson
is DateTime
, return a mutable reference to its value. Returns None
otherwise
If Bson
is Symbol
, return its value. Returns None
otherwise
If Bson
is Symbol
, return a mutable reference to its value. Returns None
otherwise
If Bson
is Timestamp
, return its value. Returns None
otherwise
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This will create the relaxed Extended JSON v2 representation of the provided Bson
.
Performs the conversion.
Examples
use std::iter::FromIterator;
use bson::Bson;
let x: Bson = Bson::from_iter(vec!["lorem", "ipsum", "dolor"]);
// or
let x: Bson = vec!["lorem", "ipsum", "dolor"].into_iter().collect();
This converts from the input JSON object as if it were MongoDB Extended JSON v2.
This converts from the input JSON as if it were MongoDB Extended JSON v2.
Auto Trait Implementations
impl RefUnwindSafe for Bson
impl UnwindSafe for Bson
Blanket Implementations
Mutably borrows from an owned value. Read more