pub struct Deck {
pub main: Vec<u32>,
pub side: Vec<u32>,
pub extra: Vec<u32>,
}Expand description
Player Deck.
Fields§
§main: Vec<u32>§side: Vec<u32>§extra: Vec<u32>Implementations§
Source§impl Deck
impl Deck
Sourcepub fn load_from_codes(codes: &[u32], mainc: usize, sidec: usize) -> Self
pub fn load_from_codes(codes: &[u32], mainc: usize, sidec: usize) -> Self
Build a deck from raw card codes, splitting into main and side.
Sourcepub fn get_hash(&self) -> HashMap<u32, usize>
pub fn get_hash(&self) -> HashMap<u32, usize>
Count each card code across main, extra, and side.
Sourcepub fn load<'a>(
&mut self,
resolve_card: impl Fn(u32) -> Option<&'a Card>,
) -> Option<DeckError>
pub fn load<'a>( &mut self, resolve_card: impl Fn(u32) -> Option<&'a Card>, ) -> Option<DeckError>
Drop unknown/token cards and move extra-deck cards into the extra.
Sourcepub fn prepare<'a>(
&mut self,
lflist: &LFList,
rule: Rule,
resolve_card: impl Fn(u32) -> Option<&'a Card>,
) -> Result<(), DeckError>
pub fn prepare<'a>( &mut self, lflist: &LFList, rule: Rule, resolve_card: impl Fn(u32) -> Option<&'a Card>, ) -> Result<(), DeckError>
Check the deck against the limit list and the rule.
Sourcepub fn check_after_replacing_side<'a>(
&self,
deck: &mut Deck,
resolve_card: impl Fn(u32) -> Option<&'a Card>,
) -> Result<(), DeckError>
pub fn check_after_replacing_side<'a>( &self, deck: &mut Deck, resolve_card: impl Fn(u32) -> Option<&'a Card>, ) -> Result<(), DeckError>
Check a deck after replacing side, comparing against this deck.
Trait Implementations§
Source§impl BinRead for Deck
impl BinRead for Deck
Source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
Read
T from the reader assuming native-endian byte order. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for Deck
impl BinWrite for Deck
Source§fn write_options<W: Write + Seek>(
&self,
__binrw_generated_var_writer: &mut W,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<()>
Source§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming little-endian byte order. Read moreimpl Eq for Deck
Source§impl From<Deck> for ReplayDeck
impl From<Deck> for ReplayDeck
Source§impl From<ReplayDeck> for Deck
impl From<ReplayDeck> for Deck
Source§fn from(value: ReplayDeck) -> Self
fn from(value: ReplayDeck) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Deck
impl RefUnwindSafe for Deck
impl Send for Deck
impl Sync for Deck
impl Unpin for Deck
impl UnsafeUnpin for Deck
impl UnwindSafe for Deck
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