Struct bson::oid::ObjectId [−][src]
pub struct ObjectId { /* fields omitted */ }
A wrapper around raw 12-byte ObjectId representations.
Methods
impl ObjectId
[src]
impl ObjectId
pub fn new() -> Result<ObjectId>
[src]
pub fn new() -> Result<ObjectId>
Generates a new ObjectID, represented in bytes. See the docs for more information.
pub fn with_bytes(bytes: [u8; 12]) -> ObjectId
[src]
pub fn with_bytes(bytes: [u8; 12]) -> ObjectId
Constructs a new ObjectId wrapper around the raw byte representation.
pub fn with_string(s: &str) -> Result<ObjectId>
[src]
pub fn with_string(s: &str) -> Result<ObjectId>
Creates an ObjectID using a 12-byte (24-char) hexadecimal string.
pub fn with_timestamp(time: u32) -> ObjectId
[src]
pub fn with_timestamp(time: u32) -> ObjectId
Creates a dummy ObjectId with a specific generation time. This method should only be used to do range queries on a field containing ObjectId instances.
pub fn bytes(&self) -> [u8; 12]
[src]
pub fn bytes(&self) -> [u8; 12]
Returns the raw byte representation of an ObjectId.
pub fn timestamp(&self) -> u32
[src]
pub fn timestamp(&self) -> u32
Retrieves the timestamp (seconds since epoch) from an ObjectId.
pub fn machine_id(&self) -> u32
[src]
pub fn machine_id(&self) -> u32
Retrieves the machine id associated with an ObjectId.
pub fn process_id(&self) -> u16
[src]
pub fn process_id(&self) -> u16
Retrieves the process id associated with an ObjectId.
pub fn counter(&self) -> u32
[src]
pub fn counter(&self) -> u32
Retrieves the increment counter from an ObjectId.
pub fn to_hex(&self) -> String
[src]
pub fn to_hex(&self) -> String
Convert the objectId to hex representation.
Trait Implementations
impl From<ObjectId> for Bson
[src]
impl From<ObjectId> for Bson
impl<'de> Deserialize<'de> for ObjectId
[src]
impl<'de> Deserialize<'de> for ObjectId
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Serialize for ObjectId
[src]
impl Serialize for ObjectId
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Clone for ObjectId
[src]
impl Clone for ObjectId
fn clone(&self) -> ObjectId
[src]
fn clone(&self) -> ObjectId
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for ObjectId
[src]
impl PartialEq for ObjectId
fn eq(&self, other: &ObjectId) -> bool
[src]
fn eq(&self, other: &ObjectId) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &ObjectId) -> bool
[src]
fn ne(&self, other: &ObjectId) -> bool
This method tests for !=
.
impl PartialOrd for ObjectId
[src]
impl PartialOrd for ObjectId
fn partial_cmp(&self, other: &ObjectId) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &ObjectId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &ObjectId) -> bool
[src]
fn lt(&self, other: &ObjectId) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &ObjectId) -> bool
[src]
fn le(&self, other: &ObjectId) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &ObjectId) -> bool
[src]
fn gt(&self, other: &ObjectId) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &ObjectId) -> bool
[src]
fn ge(&self, other: &ObjectId) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Eq for ObjectId
[src]
impl Eq for ObjectId
impl Ord for ObjectId
[src]
impl Ord for ObjectId
fn cmp(&self, other: &ObjectId) -> Ordering
[src]
fn cmp(&self, other: &ObjectId) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for ObjectId
[src]
impl Hash for ObjectId
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for ObjectId
[src]
impl Display for ObjectId
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Debug for ObjectId
[src]
impl Debug for ObjectId