Struct screeps::local::RawObjectId
source · 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 fn from_packed(packed: u128) -> Self
pub 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 copy 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
§type Err = RawObjectIdParseError
type Err = RawObjectIdParseError
The associated error which can be returned from parsing.
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§fn eq(&self, other: &RawObjectId) -> bool
fn eq(&self, other: &RawObjectId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<RawObjectId> for RawObjectId
impl PartialEq<RawObjectId> for RawObjectId
source§fn eq(&self, other: &RawObjectId) -> bool
fn eq(&self, other: &RawObjectId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T> PartialOrd<ObjectId<T>> for RawObjectId
impl<T> PartialOrd<ObjectId<T>> for RawObjectId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T> PartialOrd<RawObjectId> for ObjectId<T>
impl<T> PartialOrd<RawObjectId> for ObjectId<T>
source§fn partial_cmp(&self, other: &RawObjectId) -> Option<Ordering>
fn partial_cmp(&self, other: &RawObjectId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<RawObjectId> for RawObjectId
impl PartialOrd<RawObjectId> for RawObjectId
source§fn partial_cmp(&self, other: &RawObjectId) -> Option<Ordering>
fn partial_cmp(&self, other: &RawObjectId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more