pub enum Value {
}
Expand description
The num represents one bson value.
Any instance of this value can be expressed in this enum can be serialized to binary representation without any error
Variants§
MinValue
The MinValue. The smallest value of bson value
Null
The null value.
Int32(i32)
The signed 32bit integer.
Int64(i64)
The signed 64bit integer.
Double(f64)
The IEEE 754 binary64 floating point value.
Decimal(Decimal128)
The IEEE 754 decimal128 floating point value.
String(String)
The UTF-8 encoded string value
Document(Document)
The string key mapping
Array(Array)
The array of bson value
Binary(Binary)
The byte array
ObjectId(ObjectId)
ObjectId
Guid(Guid)
Guid In bson representation this will be expressed as UUID binary
Boolean(bool)
Boolean
DateTime(DateTime)
DateTime Time can be represented with this is 0001-01-01 to 9999-12-31 since date time in C# is so
MaxValue
The MaxValue. The biggest value of bson value
Implementations§
Source§impl Value
impl Value
Sourcepub fn get_serialized_value_len(&self) -> usize
pub fn get_serialized_value_len(&self) -> usize
Returns the size of serialized value.
This doesn’t include tag or name of key.
Sourcepub fn write_value<W: BsonWriter>(&self, w: &mut W) -> Result<(), W::Error>
pub fn write_value<W: BsonWriter>(&self, w: &mut W) -> Result<(), W::Error>
Writes the value to the BsonWriter
Source§impl Value
impl Value
pub fn as_i32(&self) -> Option<i32>
pub fn as_i64(&self) -> Option<i64>
pub fn as_f64(&self) -> Option<f64>
pub fn as_decimal128(&self) -> Option<Decimal128>
pub fn as_str(&self) -> Option<&str>
pub fn as_document(&self) -> Option<&Document>
pub fn as_document_mut(&mut self) -> Option<&mut Document>
pub fn into_document(self) -> Result<Document, Self>
pub fn as_array(&self) -> Option<&Array>
pub fn as_array_mut(&mut self) -> Option<&mut Array>
pub fn into_array(self) -> Result<Array, Self>
pub fn as_binary(&self) -> Option<&Binary>
pub fn as_binary_mut(&mut self) -> Option<&mut Binary>
pub fn into_binary(self) -> Result<Binary, Self>
pub fn as_object_id(&self) -> Option<ObjectId>
pub fn as_guid(&self) -> Option<Guid>
pub fn as_bool(&self) -> Option<bool>
pub fn as_date_time(&self) -> Option<DateTime>
pub fn is_number(&self) -> bool
pub fn to_i32(&self) -> Option<i32>
pub fn to_i64(&self) -> Option<i64>
pub fn to_f64(&self) -> Option<f64>
pub fn to_decimal(&self) -> Option<Decimal128>
Trait Implementations§
Source§impl From<Decimal128> for Value
impl From<Decimal128> for Value
Source§fn from(v: Decimal128) -> Value
fn from(v: Decimal128) -> Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more