[−][src]Enum avocado::prelude::Bson
Possible BSON value types.
Variants
FloatingPoint(f64)
64-bit binary floating point
String(String)
UTF-8 string
Array(Vec<Bson>)
Array
Document(OrderedDocument)
Embedded document
Boolean(bool)
Boolean value
Null
Null 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, OrderedDocument)
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 Bson
pub fn element_type(&self) -> ElementType | [src] |
Get the ElementType
of this value.
pub fn to_json(&self) -> Value | [src] |
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] |
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] |
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 Bson
Value helpers
pub fn as_f64(&self) -> Option<f64> | [src] |
If Bson
is FloatingPoint
, return its value. Returns None
otherwise
pub fn as_str(&self) -> Option<&str> | [src] |
If Bson
is String
, return its value. Returns None
otherwise
pub fn as_array(&self) -> Option<&Vec<Bson>> | [src] |
If Bson
is Array
, return its value. Returns None
otherwise
pub fn as_document(&self) -> Option<&OrderedDocument> | [src] |
If Bson
is Document
, return its value. Returns None
otherwise
pub fn as_bool(&self) -> Option<bool> | [src] |
If Bson
is Boolean
, return its value. Returns None
otherwise
pub fn as_i32(&self) -> Option<i32> | [src] |
If Bson
is I32
, return its value. Returns None
otherwise
pub fn as_i64(&self) -> Option<i64> | [src] |
If Bson
is I64
, return its value. Returns None
otherwise
pub fn as_object_id(&self) -> Option<&ObjectId> | [src] |
If Bson
is Objectid
, return its value. Returns None
otherwise
pub fn as_utc_date_time(&self) -> Option<&DateTime<Utc>> | [src] |
If Bson
is UtcDateTime
, return its value. Returns None
otherwise
pub fn as_symbol(&self) -> Option<&str> | [src] |
If Bson
is Symbol
, return its value. Returns None
otherwise
pub fn as_timestamp(&self) -> Option<i64> | [src] |
If Bson
is TimeStamp
, return its value. Returns None
otherwise
pub fn as_null(&self) -> Option<()> | [src] |
If Bson
is Null
, return its value. Returns None
otherwise
Trait Implementations
impl From<Role> for Bson
[src]
impl From<Role> for Bson
impl Clone for Bson
[src]
impl Clone for Bson
fn clone(&self) -> Bson | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl<'de> Deserialize<'de> for Bson
[src]
impl<'de> Deserialize<'de> for Bson
fn deserialize<D>( | [src] |
impl Serialize for Bson
[src]
impl Serialize for Bson
fn serialize<S>( | [src] |
impl From<Vec<Bson>> for Bson
[src]
impl From<Vec<Bson>> for Bson
impl From<i64> for Bson
[src]
impl From<i64> for Bson
impl From<ObjectId> for Bson
[src]
impl From<ObjectId> for Bson
impl From<(BinarySubtype, Vec<u8>)> for Bson
[src]
impl From<(BinarySubtype, Vec<u8>)> for Bson
impl From<(String, String)> for Bson
[src]
impl From<(String, String)> for Bson
impl From<u64> for Bson
[src]
impl From<u64> for Bson
impl<'a> From<&'a String> for Bson
[src]
impl<'a> From<&'a String> for Bson
impl From<bool> for Bson
[src]
impl From<bool> for Bson
impl From<f64> for Bson
[src]
impl From<f64> for Bson
impl From<(String, OrderedDocument)> for Bson
[src]
impl From<(String, OrderedDocument)> for Bson
impl From<Value> for Bson
[src]
impl From<Value> for Bson
impl From<[u8; 12]> for Bson
[src]
impl From<[u8; 12]> for Bson
impl<'a> From<&'a str> for Bson
[src]
impl<'a> From<&'a str> for Bson
impl From<DateTime<Utc>> for Bson
[src]
impl From<DateTime<Utc>> for Bson
impl From<String> for Bson
[src]
impl From<String> for Bson
impl From<f32> for Bson
[src]
impl From<f32> for Bson
impl From<OrderedDocument> for Bson
[src]
impl From<OrderedDocument> for Bson
fn from(a: OrderedDocument) -> Bson | [src] |
impl From<i32> for Bson
[src]
impl From<i32> for Bson
impl From<u32> for Bson
[src]
impl From<u32> for Bson
impl Default for Bson
[src]
impl Default for Bson
impl PartialEq<Bson> for Bson
[src]
impl PartialEq<Bson> for Bson
impl Display for Bson
[src]
impl Display for Bson
impl Debug for Bson
[src]
impl Debug for Bson
impl<T: Doc> From<Uid<T>> for Bson where
T::Id: Into<Bson>,
[src]
impl<T: Doc> From<Uid<T>> for Bson where
T::Id: Into<Bson>,
impl<T: Doc, '_> From<&'_ Uid<T>> for Bson where
T::Id: ToOwned,
<T::Id as ToOwned>::Owned: Into<Bson>,
[src]
impl<T: Doc, '_> From<&'_ Uid<T>> for Bson where
T::Id: ToOwned,
<T::Id as ToOwned>::Owned: Into<Bson>,
impl From<Order> for Bson
[src]
impl From<Order> for Bson
This impl is provided so that you can use these more expressive ordering
names instead of the not very clear 1
and -1
when constructing literal
BSON index documents.
impl From<IndexType> for Bson
[src]
impl From<IndexType> for Bson
impl From<BsonType> for Bson
[src]
impl From<BsonType> for Bson
This is possible because encoding BsonType
as a Bson
never actually
fails (the in-memory tree serializer always succeeds unless the value
being serialized itself provokes an error, which our BsonType
doesn't.)
impl From<RegexOpts> for Bson
[src]
impl From<RegexOpts> for Bson
See the explanation for BsonType
as to why this impl is possible.
impl From<DateTimeType> for Bson
[src]
impl From<DateTimeType> for Bson
See the explanation for BsonType
as to why this impl is possible.
fn from(ty: DateTimeType) -> Self | [src] |
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> From for T
[src]
impl<T> From for T
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
impl<T, U> TryInto for T where
U: TryFrom<T>,
impl<T, U> TryInto for T where
U: TryFrom<T>,
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self