pub struct ChessClock(/* private fields */);
Implementations§
Source§impl 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§
Source§impl Clone for ChessClock
impl Clone for ChessClock
Source§fn clone(&self) -> ChessClock
fn clone(&self) -> ChessClock
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ChessClock
impl RefUnwindSafe for ChessClock
impl Send for ChessClock
impl Sync for ChessClock
impl Unpin for ChessClock
impl UnwindSafe for ChessClock
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