Struct chess_clock::ChessClock
source · pub struct ChessClock(_);
Implementations
sourceimpl ChessClock
impl ChessClock
sourcepub fn new(
n_players: usize,
base_time: BaseTime,
time_per_turn: TimePerTurn
) -> ChessClock
pub fn new(
n_players: usize,
base_time: BaseTime,
time_per_turn: TimePerTurn
) -> ChessClock
Do not try to make a chess clock with 0 players, or it will panic somewhere down the line.
sourcepub fn bind<F>(self, f: F) -> ClockedFuture<F::Future>where
F: IntoFuture<Error = ()>,
pub fn bind<F>(self, f: F) -> ClockedFuture<F::Future>where
F: IntoFuture<Error = ()>,
Combine the clock with another future f
to produce a
ClockedFuture
.
sourcepub fn active_player_time_remaining(&self) -> Duration
pub fn active_player_time_remaining(&self) -> Duration
Returns the time remaining for the active player.
sourcepub fn times_remaining(&self) -> Vec<Duration>
pub fn times_remaining(&self) -> Vec<Duration>
Returns the times remaining for all players.
sourcepub fn active_player(&self) -> usize
pub fn active_player(&self) -> usize
Returns the index of the active player.
Trait Implementations
sourceimpl Clone for ChessClock
impl Clone for ChessClock
sourcefn clone(&self) -> ChessClock
fn clone(&self) -> ChessClock
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl RefUnwindSafe for ChessClock
impl Send for ChessClock
impl Sync for ChessClock
impl Unpin for ChessClock
impl UnwindSafe for ChessClock
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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