pub struct ZoneStore { /* private fields */ }Expand description
Fixed-index store for per-player zones.
The old representation was HashMap<ZoneKey, Zone>. Most callers already
route through GameState::zone, zone_mut, and cards_in_zone, so this
store preserves that API while avoiding hash lookup on hot zone access.
Implementations§
Source§impl ZoneStore
impl ZoneStore
pub fn new(players: &[PlayerId]) -> Self
pub fn get(&self, zone_type: ZoneType, owner: PlayerId) -> Option<&Zone>
pub fn get_mut( &mut self, zone_type: ZoneType, owner: PlayerId, ) -> Option<&mut Zone>
pub fn remove_card( &mut self, zone_type: ZoneType, owner: PlayerId, card: CardId, ) -> bool
pub fn add_card_to_top( &mut self, zone_type: ZoneType, owner: PlayerId, card: CardId, )
pub fn add_card_to_bottom( &mut self, zone_type: ZoneType, owner: PlayerId, card: CardId, )
pub fn take_top_card( &mut self, zone_type: ZoneType, owner: PlayerId, ) -> Option<CardId>
pub fn reorder_card( &mut self, zone_type: ZoneType, owner: PlayerId, card: CardId, index: usize, )
pub fn move_cards_to_top( &mut self, zone_type: ZoneType, owner: PlayerId, cards: &[CardId], )
pub fn move_cards_to_bottom( &mut self, zone_type: ZoneType, owner: PlayerId, cards: &[CardId], )
pub fn replace_cards( &mut self, zone_type: ZoneType, owner: PlayerId, cards: Vec<CardId>, )
pub fn shuffle_cards( &mut self, zone_type: ZoneType, owner: PlayerId, rng: &mut dyn GameRng, )
pub fn shuffle_cards_with_rand<R: Rng + ?Sized>( &mut self, zone_type: ZoneType, owner: PlayerId, rng: &mut R, )
pub fn save_lki( &mut self, zone_type: ZoneType, owner: PlayerId, card: CardId, from: ZoneType, )
pub fn card_location(&self, card: CardId) -> Option<ZoneKey>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut Zone>
pub fn iter(&self) -> impl Iterator<Item = (ZoneKey, &Zone)>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ZoneStore
impl RefUnwindSafe for ZoneStore
impl Send for ZoneStore
impl Sync for ZoneStore
impl Unpin for ZoneStore
impl UnsafeUnpin for ZoneStore
impl UnwindSafe for ZoneStore
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.