pub struct PiecePicker { /* private fields */ }Expand description
Which pieces are held, in flight and available where.
Implementations§
Source§impl PiecePicker
impl PiecePicker
Sourcepub fn remove_peer(&mut self, peer: &str)
pub fn remove_peer(&mut self, peer: &str)
A peer is gone: its holdings stop counting and its in-flight pieces return to the pool.
Sourcepub fn peer_lacks(&mut self, peer: &str, i: u32)
pub fn peer_lacks(&mut self, peer: &str, i: u32)
The peer says it cannot supply piece i after all.
Sourcepub fn availability(&self, i: u32) -> usize
pub fn availability(&self, i: u32) -> usize
Live peers holding piece i.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
True when every piece is held.
Missing pieces no live peer holds.
Trait Implementations§
Source§impl Clone for PiecePicker
impl Clone for PiecePicker
Auto Trait Implementations§
impl Freeze for PiecePicker
impl RefUnwindSafe for PiecePicker
impl Send for PiecePicker
impl Sync for PiecePicker
impl Unpin for PiecePicker
impl UnsafeUnpin for PiecePicker
impl UnwindSafe for PiecePicker
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more