pub struct World {
pub discriminator: [u8; 8],
pub name: String,
pub description: String,
pub entities: Vec<Entity>,
pub regions: Vec<Region>,
pub instances: BTreeMap<Region, BTreeMap<Entity, u64>>,
pub is_launched: bool,
pub world_authority: Pubkey,
pub bump: u8,
}Fields§
§discriminator: [u8; 8]Identifier for this specific structure
name: StringDescription of the world
description: StringDescription of the world
entities: Vec<Entity>Onchain record of what Entity types exist in the world
regions: Vec<Region>Onchain record of what Regions exist in the world
instances: BTreeMap<Region, BTreeMap<Entity, u64>>Source of truth for what Instances exist in the world
is_launched: boolDetermines if the World is already launched and instances can now be Created, Updated, and Deleted outside of the CreateWorld (Initialization) Instruction
Overaching authority who has access to state changing operations
bump: u8Canonical bump for World
Implementations§
Source§impl World
impl World
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Is true if World is initialized
Sourcepub fn is_uninitialized(&self) -> bool
pub fn is_uninitialized(&self) -> bool
Is true if World is uninitialized
Sourcepub fn new(
name: String,
description: String,
world_authority: Pubkey,
regions: Vec<Region>,
entities: Vec<Entity>,
bump: u8,
preload: bool,
) -> Self
pub fn new( name: String, description: String, world_authority: Pubkey, regions: Vec<Region>, entities: Vec<Entity>, bump: u8, preload: bool, ) -> Self
Create new World state
§Arguments
name- AStringthat holds the name of the worlddescription- AStringthat holds the description of the worldworld_authority- APubkeyof the authority who can change the world’s account dataregions- A Vector of the new typeRegionholding all the existing regions in the worldentities- A Vector of the new typeEntityholding all the existing entities in the worldbump- Au8holding the canonical bump of the World’s onchain account used for PDA derivationpreload- Aboolthat allows preloading ofBTreeMapkeys in theWorldinstancesproperty
Trait Implementations§
Source§impl BorshDeserialize for World
impl BorshDeserialize for World
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for World
impl BorshSerialize for World
Source§impl SplDiscriminate for World
impl SplDiscriminate for World
Source§const SPL_DISCRIMINATOR: ArrayDiscriminator
const SPL_DISCRIMINATOR: ArrayDiscriminator
The 8-byte discriminator as a
[u8; 8]Source§const SPL_DISCRIMINATOR_SLICE: &'static [u8] = _
const SPL_DISCRIMINATOR_SLICE: &'static [u8] = _
The 8-byte discriminator as a slice (
&[u8])impl Eq for World
impl StructuralPartialEq for World
Auto Trait Implementations§
impl Freeze for World
impl RefUnwindSafe for World
impl Send for World
impl Sync for World
impl Unpin for World
impl UnwindSafe for World
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more