schnapsen_rs

Struct SchnapsenDuo

Source
pub struct SchnapsenDuo { /* private fields */ }

Implementations§

Source§

impl SchnapsenDuo

Source

pub fn new(player_ids: &[String; 2]) -> Self

Source

pub fn on_priv_event( &mut self, player: Arc<RwLock<Player>>, callback: impl Fn(PrivateEvent) + Send + Sync + 'static, )

Source

pub fn on_pub_event( &mut self, callback: impl Fn(PublicEvent) + Send + Sync + 'static, )

Source

pub fn off_pub_event( &mut self, callback: impl Fn(PublicEvent) + Send + Sync + 'static, )

Source

pub fn off_priv_event( &mut self, player: &Player, callback: impl Fn(PrivateEvent) + Send + Sync + 'static, )

Source

pub fn get_player(&self, player_id: &str) -> Option<Arc<RwLock<Player>>>

Source

pub fn get_non_active_player(&self) -> Option<Arc<RwLock<Player>>>

Source

pub fn cutt_deck( &mut self, player: Arc<RwLock<Player>>, cards_to_take: usize, ) -> Result<(), PlayerError>

Source

pub fn is_active(&self, player: &Player) -> bool

Source

pub fn close_talon( &mut self, player: Arc<RwLock<Player>>, ) -> Result<(), PlayerError>

Source

pub fn take_cards_til( &mut self, player: Arc<RwLock<Player>>, idx: usize, ) -> Result<Vec<Card>, PlayerError>

Source

pub fn get_player_with_greatest_card( &self, ) -> Result<Arc<RwLock<Player>>, PlayerError>

Source

pub fn recreate_deck(&mut self)

Source

pub fn distribute_cards(&mut self) -> Result<(), PlayerError>

Source

pub fn set_active_player( &mut self, player: Arc<RwLock<Player>>, ) -> Result<(), PlayerError>

Source

pub fn play_card( &mut self, player: Arc<RwLock<Player>>, card: Card, ) -> Result<(), PlayerError>

Source

pub fn swap_trump( &mut self, player: Arc<RwLock<Player>>, card: Card, ) -> Result<Card, PlayerError>

Source

pub fn announce_40( &mut self, player: &Player, ) -> Result<Announcement, PlayerError>

Source

pub fn announce_20( &mut self, player: &Player, cards: [Card; 2], ) -> Result<Announcement, PlayerError>

Trait Implementations§

Source§

impl Hash for SchnapsenDuo

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Send for SchnapsenDuo

Source§

impl Sync for SchnapsenDuo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V