pub struct ObjectId(/* private fields */);
Expand description
A wrapper around raw 12-byte ObjectId
representations.
Implementations§
Source§impl ObjectId
impl ObjectId
Sourcepub fn new() -> Result<ObjectId, Error>
pub fn new() -> Result<ObjectId, Error>
Generates a new ObjectId, represented in bytes. See the docs for more information.
Sourcepub fn with_bytes(bytes: [u8; 12]) -> ObjectId
pub fn with_bytes(bytes: [u8; 12]) -> ObjectId
Constructs a new ObjectId wrapper around the raw byte representation.
Sourcepub fn with_string(oid: &str) -> Result<ObjectId, Error>
pub fn with_string(oid: &str) -> Result<ObjectId, Error>
Creates an ObjectId using a 12-byte (24-char) hexadecimal string.
Sourcepub fn with_timestamp(time: u32) -> ObjectId
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.
Sourcepub fn machine_id(&self) -> u32
pub fn machine_id(&self) -> u32
Retrieves the machine id associated with an ObjectId.
Sourcepub fn process_id(&self) -> u16
pub fn process_id(&self) -> u16
Retrieves the process id associated with an ObjectId.
Trait Implementations§
Source§impl Ord for ObjectId
impl Ord for ObjectId
Source§impl PartialOrd for ObjectId
impl PartialOrd for ObjectId
impl Eq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
impl Freeze for ObjectId
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnwindSafe for ObjectId
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
Mutably borrows from an owned value. Read more