Enum bson::RawBsonRef
source · [−]pub enum RawBsonRef<'a> {
Show 21 variants
Double(f64),
String(&'a str),
Array(&'a RawArray),
Document(&'a RawDocument),
Boolean(bool),
Null,
RegularExpression(RawRegexRef<'a>),
JavaScriptCode(&'a str),
JavaScriptCodeWithScope(RawJavaScriptCodeWithScopeRef<'a>),
Int32(i32),
Int64(i64),
Timestamp(Timestamp),
Binary(RawBinaryRef<'a>),
ObjectId(ObjectId),
DateTime(DateTime),
Symbol(&'a str),
Decimal128(Decimal128),
Undefined,
MaxKey,
MinKey,
DbPointer(RawDbPointerRef<'a>),
}
Expand description
A BSON value referencing raw bytes stored elsewhere.
Variants
Double(f64)
64-bit binary floating point
String(&'a str)
UTF-8 string
Array(&'a RawArray)
Array
Document(&'a RawDocument)
Embedded document
Boolean(bool)
Boolean value
Null
Null value
RegularExpression(RawRegexRef<'a>)
Regular expression
JavaScriptCode(&'a str)
JavaScript code
JavaScriptCodeWithScope(RawJavaScriptCodeWithScopeRef<'a>)
JavaScript code w/ scope
Int32(i32)
32-bit signed integer
Int64(i64)
64-bit signed integer
Timestamp(Timestamp)
Timestamp
Binary(RawBinaryRef<'a>)
Binary data
ObjectId(ObjectId)
DateTime(DateTime)
UTC datetime
Symbol(&'a str)
Symbol (Deprecated)
Decimal128(Decimal128)
Undefined
Undefined value (Deprecated)
MaxKey
Max key
MinKey
Min key
DbPointer(RawDbPointerRef<'a>)
DBPointer (Deprecated)
Implementations
sourceimpl<'a> RawBsonRef<'a>
impl<'a> RawBsonRef<'a>
sourcepub fn element_type(&self) -> ElementType
pub fn element_type(&self) -> ElementType
Get the ElementType
of this value.
sourcepub fn as_f64(self) -> Option<f64>
pub fn as_f64(self) -> Option<f64>
Gets the f64
that’s referenced or returns None
if the referenced value isn’t a BSON
double.
sourcepub fn as_str(self) -> Option<&'a str>
pub fn as_str(self) -> Option<&'a str>
Gets the &str
that’s referenced or returns None
if the referenced value isn’t a BSON
String.
sourcepub fn as_array(self) -> Option<&'a RawArray>
pub fn as_array(self) -> Option<&'a RawArray>
Gets the RawArray
that’s referenced or returns None
if the referenced value
isn’t a BSON array.
sourcepub fn as_document(self) -> Option<&'a RawDocument>
pub fn as_document(self) -> Option<&'a RawDocument>
Gets the RawDocument
that’s referenced or returns None
if the referenced value
isn’t a BSON document.
sourcepub fn as_bool(self) -> Option<bool>
pub fn as_bool(self) -> Option<bool>
Gets the bool
that’s referenced or returns None
if the referenced value isn’t a BSON
boolean.
sourcepub fn as_i32(self) -> Option<i32>
pub fn as_i32(self) -> Option<i32>
Gets the i32
that’s referenced or returns None
if the referenced value isn’t a BSON
Int32.
sourcepub fn as_i64(self) -> Option<i64>
pub fn as_i64(self) -> Option<i64>
Gets the i64
that’s referenced or returns None
if the referenced value isn’t a BSON
Int64.
sourcepub fn as_object_id(self) -> Option<ObjectId>
pub fn as_object_id(self) -> Option<ObjectId>
Gets the crate::oid::ObjectId
that’s referenced or returns None
if the referenced
value isn’t a BSON ObjectID.
sourcepub fn as_binary(self) -> Option<RawBinaryRef<'a>>
pub fn as_binary(self) -> Option<RawBinaryRef<'a>>
Gets the RawBinaryRef
that’s referenced or returns None
if the referenced value isn’t
a BSON binary.
sourcepub fn as_regex(self) -> Option<RawRegexRef<'a>>
pub fn as_regex(self) -> Option<RawRegexRef<'a>>
Gets the RawRegexRef
that’s referenced or returns None
if the referenced value isn’t a
BSON regular expression.
sourcepub fn as_datetime(self) -> Option<DateTime>
pub fn as_datetime(self) -> Option<DateTime>
Gets the crate::DateTime
that’s referenced or returns None
if the referenced value
isn’t a BSON datetime.
sourcepub fn as_symbol(self) -> Option<&'a str>
pub fn as_symbol(self) -> Option<&'a str>
Gets the symbol that’s referenced or returns None
if the referenced value isn’t a BSON
symbol.
sourcepub fn as_timestamp(self) -> Option<Timestamp>
pub fn as_timestamp(self) -> Option<Timestamp>
Gets the crate::Timestamp
that’s referenced or returns None
if the referenced value
isn’t a BSON timestamp.
sourcepub fn as_null(self) -> Option<()>
pub fn as_null(self) -> Option<()>
Gets the null value that’s referenced or returns None
if the referenced value isn’t a BSON
null.
sourcepub fn as_db_pointer(self) -> Option<RawDbPointerRef<'a>>
pub fn as_db_pointer(self) -> Option<RawDbPointerRef<'a>>
Gets the RawDbPointerRef
that’s referenced or returns None
if the referenced value
isn’t a BSON DB pointer.
sourcepub fn as_javascript(self) -> Option<&'a str>
pub fn as_javascript(self) -> Option<&'a str>
Gets the code that’s referenced or returns None
if the referenced value isn’t a BSON
JavaScript.
sourcepub fn as_javascript_with_scope(
self
) -> Option<RawJavaScriptCodeWithScopeRef<'a>>
pub fn as_javascript_with_scope(
self
) -> Option<RawJavaScriptCodeWithScopeRef<'a>>
Gets the RawJavaScriptCodeWithScope
that’s referenced or returns None
if the
referenced value isn’t a BSON JavaScript with scope.
sourcepub fn to_raw_bson(self) -> RawBson
pub fn to_raw_bson(self) -> RawBson
Convert this RawBsonRef
to the equivalent RawBson
.
Trait Implementations
sourceimpl<'a> Clone for RawBsonRef<'a>
impl<'a> Clone for RawBsonRef<'a>
sourcefn clone(&self) -> RawBsonRef<'a>
fn clone(&self) -> RawBsonRef<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for RawBsonRef<'a>
impl<'a> Debug for RawBsonRef<'a>
sourceimpl<'de: 'a, 'a> Deserialize<'de> for RawBsonRef<'a>
impl<'de: 'a, 'a> Deserialize<'de> for RawBsonRef<'a>
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> From<&'a Binary> for RawBsonRef<'a>
impl<'a> From<&'a Binary> for RawBsonRef<'a>
sourceimpl<'a> From<&'a RawArray> for RawBsonRef<'a>
impl<'a> From<&'a RawArray> for RawBsonRef<'a>
sourceimpl<'a> From<&'a RawArrayBuf> for RawBsonRef<'a>
impl<'a> From<&'a RawArrayBuf> for RawBsonRef<'a>
sourcefn from(a: &'a RawArrayBuf) -> Self
fn from(a: &'a RawArrayBuf) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<&'a RawDocument> for RawBsonRef<'a>
impl<'a> From<&'a RawDocument> for RawBsonRef<'a>
sourcefn from(d: &'a RawDocument) -> Self
fn from(d: &'a RawDocument) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<&'a RawDocumentBuf> for RawBsonRef<'a>
impl<'a> From<&'a RawDocumentBuf> for RawBsonRef<'a>
sourcefn from(d: &'a RawDocumentBuf) -> Self
fn from(d: &'a RawDocumentBuf) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<&'a str> for RawBsonRef<'a>
impl<'a> From<&'a str> for RawBsonRef<'a>
sourceimpl<'a> From<DateTime> for RawBsonRef<'a>
impl<'a> From<DateTime> for RawBsonRef<'a>
sourceimpl<'a> From<Decimal128> for RawBsonRef<'a>
impl<'a> From<Decimal128> for RawBsonRef<'a>
sourcefn from(d: Decimal128) -> Self
fn from(d: Decimal128) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<ObjectId> for RawBsonRef<'a>
impl<'a> From<ObjectId> for RawBsonRef<'a>
sourceimpl<'a> From<RawBinaryRef<'a>> for RawBsonRef<'a>
impl<'a> From<RawBinaryRef<'a>> for RawBsonRef<'a>
sourcefn from(b: RawBinaryRef<'a>) -> Self
fn from(b: RawBinaryRef<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<RawJavaScriptCodeWithScopeRef<'a>> for RawBsonRef<'a>
impl<'a> From<RawJavaScriptCodeWithScopeRef<'a>> for RawBsonRef<'a>
sourcefn from(code_w_scope: RawJavaScriptCodeWithScopeRef<'a>) -> Self
fn from(code_w_scope: RawJavaScriptCodeWithScopeRef<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<RawRegexRef<'a>> for RawBsonRef<'a>
impl<'a> From<RawRegexRef<'a>> for RawBsonRef<'a>
sourcefn from(re: RawRegexRef<'a>) -> Self
fn from(re: RawRegexRef<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<Timestamp> for RawBsonRef<'a>
impl<'a> From<Timestamp> for RawBsonRef<'a>
sourceimpl<'a> From<bool> for RawBsonRef<'a>
impl<'a> From<bool> for RawBsonRef<'a>
sourceimpl<'a> From<f64> for RawBsonRef<'a>
impl<'a> From<f64> for RawBsonRef<'a>
sourceimpl<'a> From<i32> for RawBsonRef<'a>
impl<'a> From<i32> for RawBsonRef<'a>
sourceimpl<'a> From<i64> for RawBsonRef<'a>
impl<'a> From<i64> for RawBsonRef<'a>
sourceimpl<'a> PartialEq<RawBsonRef<'a>> for RawBsonRef<'a>
impl<'a> PartialEq<RawBsonRef<'a>> for RawBsonRef<'a>
sourcefn eq(&self, other: &RawBsonRef<'a>) -> bool
fn eq(&self, other: &RawBsonRef<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RawBsonRef<'a>) -> bool
fn ne(&self, other: &RawBsonRef<'a>) -> bool
This method tests for !=
.
sourceimpl<'a> Serialize for RawBsonRef<'a>
impl<'a> Serialize for RawBsonRef<'a>
sourceimpl<'a> TryFrom<RawBsonRef<'a>> for Bson
impl<'a> TryFrom<RawBsonRef<'a>> for Bson
impl<'a> Copy for RawBsonRef<'a>
impl<'a> StructuralPartialEq for RawBsonRef<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for RawBsonRef<'a>
impl<'a> Send for RawBsonRef<'a>
impl<'a> Sync for RawBsonRef<'a>
impl<'a> Unpin for RawBsonRef<'a>
impl<'a> UnwindSafe for RawBsonRef<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more