Struct lordeckcodes::Deck
source · [−]pub struct Deck(_);
Expand description
Holds a set of CardCodeAndCount
.
Implementations
sourceimpl Deck
impl Deck
sourcepub fn from_vec(vec: Vec<CardCodeAndCount>) -> Deck
pub fn from_vec(vec: Vec<CardCodeAndCount>) -> Deck
Create a new Deck
from a Vec
of CardCodeAndCount
.
Examples
use lordeckcodes::{CardCodeAndCount, Deck};
let deck = Deck::from_vec(vec![
CardCodeAndCount::from_data("01SI015", 3).unwrap(),
CardCodeAndCount::from_data("01SI044", 3).unwrap(),
CardCodeAndCount::from_data("01SI048", 3).unwrap(),
CardCodeAndCount::from_data("01SI054", 3).unwrap(),
]);
sourcepub fn add(&mut self, card: CardCodeAndCount)
pub fn add(&mut self, card: CardCodeAndCount)
Add a CardCodeAndCount
to the Deck
.
sourcepub fn add_from_data(&mut self, code: &str, count: i32) -> Result<(), LorError>
pub fn add_from_data(&mut self, code: &str, count: i32) -> Result<(), LorError>
Create and add a new CardCodeAndCount
to the deck from the provided data.
sourcepub fn cards(&self) -> &Vec<CardCodeAndCount>
pub fn cards(&self) -> &Vec<CardCodeAndCount>
Obtain a reference to the list of CardCodeAndCount
.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Deck
impl<'de> Deserialize<'de> for Deck
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> FromIterator<&'a (&'a str, i32)> for Deck
impl<'a> FromIterator<&'a (&'a str, i32)> for Deck
Auto Trait Implementations
impl RefUnwindSafe for Deck
impl Send for Deck
impl Sync for Deck
impl Unpin for Deck
impl UnwindSafe for Deck
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more