[][src]Trait screeps::objects::HasId

pub unsafe trait HasId: RoomObjectProperties {
    fn untyped_id(&self) -> RawObjectId { ... }
fn id(&self) -> ObjectId<Self>
    where
        Self: Sized
, { ... } }

Trait covering all objects with an id.

Provided methods

fn untyped_id(&self) -> RawObjectId

Retrieves this object's id as an untyped, packed value.

This has no major differences from HasId::id except for the return value not being typed by the kind of thing it points to. As the type of an ObjectId can be freely changed, that isn't a big deal.

fn id(&self) -> ObjectId<Self> where
    Self: Sized

Retrieves this object's id as a typed, packed value.

This can be helpful for use with game::get_object_typed, as it will force rust to infer the proper return type.

If an ID without these protections is needed, use HasId::untyped_id, or RawObjectId::from(x.id()).

Note that the ID returned is also stored as a packed, 12-byte value on the stack, so it's fairly efficient to move and copy around.

Loading content...

Implementors

impl HasId for Structure[src]

impl HasId for ConstructionSite[src]

impl HasId for Creep[src]

impl HasId for Deposit[src]

impl HasId for Mineral[src]

impl HasId for Nuke[src]

impl HasId for OwnedStructure[src]

impl HasId for PowerCreep[src]

impl HasId for Resource[src]

impl HasId for Ruin[src]

impl HasId for Source[src]

impl HasId for StructureContainer[src]

impl HasId for StructureController[src]

impl HasId for StructureExtension[src]

impl HasId for StructureExtractor[src]

impl HasId for StructureFactory[src]

impl HasId for StructureInvaderCore[src]

impl HasId for StructureKeeperLair[src]

impl HasId for StructureLab[src]

impl HasId for StructureLink[src]

impl HasId for StructureNuker[src]

impl HasId for StructureObserver[src]

impl HasId for StructurePortal[src]

impl HasId for StructurePowerBank[src]

impl HasId for StructurePowerSpawn[src]

impl HasId for StructureRampart[src]

impl HasId for StructureRoad[src]

impl HasId for StructureSpawn[src]

impl HasId for StructureStorage[src]

impl HasId for StructureTerminal[src]

impl HasId for StructureTower[src]

impl HasId for StructureWall[src]

impl HasId for Tombstone[src]

Loading content...