pub struct RawObjectId { /* private fields */ }
Expand description
Represents an Object ID using a packed 12-byte representation
Each object id in screeps is represented by a Mongo GUID, which, while not guaranteed, is unlikely to change. This takes advantage of that by storing a packed representation.
§Ordering
To facilitate use as a key in a BTreeMap
or other similar data
structures, ObjectId
implements PartialOrd
and Ord
.
RawObjectId
’s are ordered by the corresponding order of their underlying
byte values. See ObjectId
documentation for more information.
Implementations§
Source§impl RawObjectId
impl RawObjectId
Sourcepub const fn from_packed(packed: u128) -> Self
pub const fn from_packed(packed: u128) -> Self
Creates an object ID from its packed representation.
The input to this function is the bytes representing the up-to-24 hex digits in the object id.
Sourcepub fn to_array_string(&self) -> ArrayString<24>
pub fn to_array_string(&self) -> ArrayString<24>
Formats this object ID as a string on the stack.
This is equivalent to ToString::to_string
, but involves no
allocation.
Trait Implementations§
Source§impl Clone for RawObjectId
impl Clone for RawObjectId
Source§fn clone(&self) -> RawObjectId
fn clone(&self) -> RawObjectId
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RawObjectId
impl Debug for RawObjectId
Source§impl<'de> Deserialize<'de> for RawObjectId
impl<'de> Deserialize<'de> for RawObjectId
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for RawObjectId
impl Display for RawObjectId
Source§impl<T> From<ObjectId<T>> for RawObjectId
impl<T> From<ObjectId<T>> for RawObjectId
Source§impl From<RawObjectId> for ArrayString<24>
impl From<RawObjectId> for ArrayString<24>
Source§fn from(id: RawObjectId) -> Self
fn from(id: RawObjectId) -> Self
Converts to this type from the input type.
Source§impl<T> From<RawObjectId> for ObjectId<T>
impl<T> From<RawObjectId> for ObjectId<T>
Source§fn from(raw: RawObjectId) -> Self
fn from(raw: RawObjectId) -> Self
Converts to this type from the input type.
Source§impl From<RawObjectId> for String
impl From<RawObjectId> for String
Source§fn from(id: RawObjectId) -> Self
fn from(id: RawObjectId) -> Self
Converts to this type from the input type.
Source§impl From<RawObjectId> for u128
impl From<RawObjectId> for u128
Source§fn from(id: RawObjectId) -> Self
fn from(id: RawObjectId) -> Self
Converts to this type from the input type.
Source§impl From<u128> for RawObjectId
impl From<u128> for RawObjectId
Source§impl FromStr for RawObjectId
impl FromStr for RawObjectId
Source§impl Hash for RawObjectId
impl Hash for RawObjectId
Source§impl Ord for RawObjectId
impl Ord for RawObjectId
Source§fn cmp(&self, other: &RawObjectId) -> Ordering
fn cmp(&self, other: &RawObjectId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialEq<ObjectId<T>> for RawObjectId
impl<T> PartialEq<ObjectId<T>> for RawObjectId
Source§impl<T> PartialEq<RawObjectId> for ObjectId<T>
impl<T> PartialEq<RawObjectId> for ObjectId<T>
Source§impl PartialEq for RawObjectId
impl PartialEq for RawObjectId
Source§impl<T> PartialOrd<ObjectId<T>> for RawObjectId
impl<T> PartialOrd<ObjectId<T>> for RawObjectId
Source§impl<T> PartialOrd<RawObjectId> for ObjectId<T>
impl<T> PartialOrd<RawObjectId> for ObjectId<T>
Source§impl PartialOrd for RawObjectId
impl PartialOrd for RawObjectId
Source§impl Serialize for RawObjectId
impl Serialize for RawObjectId
Source§impl TryFrom<JsString> for RawObjectId
impl TryFrom<JsString> for RawObjectId
impl Copy for RawObjectId
impl Eq for RawObjectId
impl StructuralPartialEq for RawObjectId
Auto Trait Implementations§
impl Freeze for RawObjectId
impl RefUnwindSafe for RawObjectId
impl Send for RawObjectId
impl Sync for RawObjectId
impl Unpin for RawObjectId
impl UnwindSafe for RawObjectId
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