pub enum RawBson {
Show 21 variants
Double(f64),
String(String),
Array(RawArrayBuf),
Document(RawDocumentBuf),
Boolean(bool),
Null,
RegularExpression(Regex),
JavaScriptCode(String),
JavaScriptCodeWithScope(RawJavaScriptCodeWithScope),
Int32(i32),
Int64(i64),
Timestamp(Timestamp),
Binary(Binary),
ObjectId(ObjectId),
DateTime(DateTime),
Symbol(String),
Decimal128(Decimal128),
Undefined,
MaxKey,
MinKey,
DbPointer(DbPointer),
}
Expand description
A BSON value backed by owned raw BSON bytes.
Variants§
Double(f64)
64-bit binary floating point
String(String)
UTF-8 string
Array(RawArrayBuf)
Array
Document(RawDocumentBuf)
Embedded document
Boolean(bool)
Boolean value
Null
Null value
RegularExpression(Regex)
Regular expression
JavaScriptCode(String)
JavaScript code
JavaScriptCodeWithScope(RawJavaScriptCodeWithScope)
JavaScript code w/ scope
Int32(i32)
32-bit signed integer
Int64(i64)
64-bit signed integer
Timestamp(Timestamp)
Timestamp
Binary(Binary)
Binary data
ObjectId(ObjectId)
DateTime(DateTime)
UTC datetime
Symbol(String)
Symbol (Deprecated)
Decimal128(Decimal128)
Undefined
Undefined value (Deprecated)
MaxKey
Max key
MinKey
Min key
DbPointer(DbPointer)
DBPointer (Deprecated)
Implementations§
source§impl RawBson
impl RawBson
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 wrapped f64
value or returns None
if the value isn’t a BSON
double.
sourcepub fn as_array(&self) -> Option<&RawArray>
pub fn as_array(&self) -> Option<&RawArray>
Gets a reference to the RawArrayBuf
that’s wrapped or returns None
if the wrapped
value isn’t a BSON array.
sourcepub fn as_array_mut(&mut self) -> Option<&mut RawArrayBuf>
pub fn as_array_mut(&mut self) -> Option<&mut RawArrayBuf>
Gets a mutable reference to the RawArrayBuf
that’s wrapped or returns None
if the
wrapped value isn’t a BSON array.
sourcepub fn as_document(&self) -> Option<&RawDocument>
pub fn as_document(&self) -> Option<&RawDocument>
Gets a reference to the RawDocumentBuf
that’s wrapped or returns None
if the wrapped
value isn’t a BSON document.
sourcepub fn as_document_mut(&mut self) -> Option<&mut RawDocumentBuf>
pub fn as_document_mut(&mut self) -> Option<&mut RawDocumentBuf>
Gets a mutable reference to the RawDocumentBuf
that’s wrapped or returns None
if the
wrapped value isn’t a BSON document.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Gets the wrapped bool
value or returns None
if the wrapped value isn’t a BSON
boolean.
sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
Gets the wrapped i32
value or returns None
if the wrapped value isn’t a BSON
Int32.
sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
Gets the wrapped i64
value or returns None
if the wrapped value isn’t a BSON
Int64.
sourcepub fn as_object_id(&self) -> Option<ObjectId>
pub fn as_object_id(&self) -> Option<ObjectId>
Gets the wrapped crate::oid::ObjectId
value or returns None
if the wrapped value
isn’t a BSON ObjectID.
sourcepub fn as_binary(&self) -> Option<RawBinaryRef<'_>>
pub fn as_binary(&self) -> Option<RawBinaryRef<'_>>
sourcepub fn as_regex(&self) -> Option<RawRegexRef<'_>>
pub fn as_regex(&self) -> Option<RawRegexRef<'_>>
sourcepub fn as_datetime(&self) -> Option<DateTime>
pub fn as_datetime(&self) -> Option<DateTime>
Gets the wrapped crate::DateTime
value or returns None
if the wrapped value isn’t a
BSON datetime.
sourcepub fn as_symbol(&self) -> Option<&str>
pub fn as_symbol(&self) -> Option<&str>
Gets a reference to the symbol that’s wrapped or returns None
if the wrapped value isn’t
a BSON Symbol.
sourcepub fn as_timestamp(&self) -> Option<Timestamp>
pub fn as_timestamp(&self) -> Option<Timestamp>
Gets the wrapped crate::Timestamp
value or returns None
if the wrapped value isn’t a
BSON datetime.
sourcepub fn as_null(&self) -> Option<()>
pub fn as_null(&self) -> Option<()>
Returns Some(())
if this value is null, otherwise returns None
.
sourcepub fn as_db_pointer(&self) -> Option<RawDbPointerRef<'_>>
pub fn as_db_pointer(&self) -> Option<RawDbPointerRef<'_>>
Gets a reference to the crate::DbPointer
that’s wrapped or returns None
if the
wrapped value isn’t a BSON DbPointer.
sourcepub fn as_javascript(&self) -> Option<&str>
pub fn as_javascript(&self) -> Option<&str>
Gets a reference to the code that’s wrapped or returns None
if the wrapped value isn’t a
BSON JavaScript code.
sourcepub fn as_javascript_with_scope(
&self,
) -> Option<RawJavaScriptCodeWithScopeRef<'_>>
pub fn as_javascript_with_scope( &self, ) -> Option<RawJavaScriptCodeWithScopeRef<'_>>
Gets a reference to the RawJavaScriptCodeWithScope
that’s wrapped or returns None
if the wrapped value isn’t a BSON JavaScript code with scope value.
sourcepub fn as_raw_bson_ref(&self) -> RawBsonRef<'_>
pub fn as_raw_bson_ref(&self) -> RawBsonRef<'_>
Gets a RawBsonRef
value referencing this owned raw BSON value.
Trait Implementations§
source§impl<'de> Deserialize<'de> for RawBson
impl<'de> Deserialize<'de> for RawBson
source§fn 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>,
source§impl From<Decimal128> for RawBson
impl From<Decimal128> for RawBson
source§fn from(d: Decimal128) -> Self
fn from(d: Decimal128) -> Self
source§impl From<RawArrayBuf> for RawBson
impl From<RawArrayBuf> for RawBson
source§fn from(a: RawArrayBuf) -> Self
fn from(a: RawArrayBuf) -> Self
source§impl From<RawDocumentBuf> for RawBson
impl From<RawDocumentBuf> for RawBson
source§fn from(d: RawDocumentBuf) -> Self
fn from(d: RawDocumentBuf) -> Self
source§impl From<RawJavaScriptCodeWithScope> for RawBson
impl From<RawJavaScriptCodeWithScope> for RawBson
source§fn from(code_w_scope: RawJavaScriptCodeWithScope) -> Self
fn from(code_w_scope: RawJavaScriptCodeWithScope) -> Self
source§impl<'a> TryInto<RawBson> for RawElement<'a>
impl<'a> TryInto<RawBson> for RawElement<'a>
impl StructuralPartialEq for RawBson
Auto Trait Implementations§
impl Freeze for RawBson
impl RefUnwindSafe for RawBson
impl Send for RawBson
impl Sync for RawBson
impl Unpin for RawBson
impl UnwindSafe for RawBson
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.