Trait screeps::traits::MaybeHasId
source · pub trait MaybeHasId {
// Required method
fn try_js_raw_id(&self) -> Option<JsString>;
// Provided methods
fn try_id(&self) -> Option<ObjectId<Self>>
where Self: Sized { ... }
fn try_raw_id(&self) -> Option<RawObjectId> { ... }
fn try_js_id(&self) -> Option<JsObjectId<Self>>
where Self: Sized { ... }
}
Expand description
Trait for all game objects which may (or may not) have an associated unique identifier.
Required Methods§
sourcefn try_js_raw_id(&self) -> Option<JsString>
fn try_js_raw_id(&self) -> Option<JsString>
Object ID of the object stored in JavaScript memory, without its
associated type information, or None
if the object doesn’t currently
have an ID.
Provided Methods§
sourcefn try_id(&self) -> Option<ObjectId<Self>>where
Self: Sized,
fn try_id(&self) -> Option<ObjectId<Self>>where
Self: Sized,
Object ID of the object, which can be used to efficiently fetch a
fresh reference to the object on subsequent ticks, or None
if the
object doesn’t currently have an ID.
sourcefn try_raw_id(&self) -> Option<RawObjectId>
fn try_raw_id(&self) -> Option<RawObjectId>
Object ID of the object, without its associated type information, or
None
if the object doesn’t currently have an ID.
sourcefn try_js_id(&self) -> Option<JsObjectId<Self>>where
Self: Sized,
fn try_js_id(&self) -> Option<JsObjectId<Self>>where
Self: Sized,
Object ID of the object stored in JavaScript memory, which can be used
to efficiently fetch a fresh reference to the object on subsequent
ticks, or None
if the object doesn’t currently have an ID.