pub struct PlottedPieces<FarmIndex> { /* private fields */ }Expand description
Wrapper data structure for pieces plotted under multiple plots
Implementations§
Source§impl<FarmIndex> PlottedPieces<FarmIndex>
impl<FarmIndex> PlottedPieces<FarmIndex>
Sourcepub fn contains_piece(&self, piece_index: &PieceIndex) -> bool
pub fn contains_piece(&self, piece_index: &PieceIndex) -> bool
Check if piece is known and can be retrieved
Sourcepub fn read_piece(
&self,
piece_index: PieceIndex,
) -> Option<impl Future<Output = Option<Piece>> + use<FarmIndex> + 'static>
pub fn read_piece( &self, piece_index: PieceIndex, ) -> Option<impl Future<Output = Option<Piece>> + use<FarmIndex> + 'static>
Read plotted piece from one of the farms.
If piece doesn’t exist None is returned, if by the time future is polled piece is no
longer in the plot, future will resolve with None.
Sourcepub fn add_sector(
&mut self,
farm_index: FarmIndex,
plotted_sector: &PlottedSector,
)
pub fn add_sector( &mut self, farm_index: FarmIndex, plotted_sector: &PlottedSector, )
Add new sector to collect plotted pieces
Sourcepub fn delete_sector(
&mut self,
farm_index: FarmIndex,
plotted_sector: &PlottedSector,
)
pub fn delete_sector( &mut self, farm_index: FarmIndex, plotted_sector: &PlottedSector, )
Add old sector from plotted pieces (happens on replotting)
Sourcepub fn add_farm(
&mut self,
farm_index: FarmIndex,
piece_reader: Arc<dyn PieceReader>,
)
pub fn add_farm( &mut self, farm_index: FarmIndex, piece_reader: Arc<dyn PieceReader>, )
Add new farm with corresponding piece reader
Sourcepub fn delete_farm(&mut self, farm_index: FarmIndex)
pub fn delete_farm(&mut self, farm_index: FarmIndex)
Add all sectors of the farm
Sourcepub fn piece_indices(&self) -> impl Iterator<Item = &PieceIndex>
pub fn piece_indices(&self) -> impl Iterator<Item = &PieceIndex>
Iterator over all unique piece indices plotted
Trait Implementations§
Source§impl<FarmIndex: Debug> Debug for PlottedPieces<FarmIndex>
impl<FarmIndex: Debug> Debug for PlottedPieces<FarmIndex>
Source§impl<FarmIndex: Default> Default for PlottedPieces<FarmIndex>
impl<FarmIndex: Default> Default for PlottedPieces<FarmIndex>
Source§fn default() -> PlottedPieces<FarmIndex>
fn default() -> PlottedPieces<FarmIndex>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<FarmIndex> Freeze for PlottedPieces<FarmIndex>
impl<FarmIndex> !RefUnwindSafe for PlottedPieces<FarmIndex>
impl<FarmIndex> Send for PlottedPieces<FarmIndex>where
FarmIndex: Send,
impl<FarmIndex> Sync for PlottedPieces<FarmIndex>where
FarmIndex: Sync,
impl<FarmIndex> Unpin for PlottedPieces<FarmIndex>where
FarmIndex: Unpin,
impl<FarmIndex> !UnwindSafe for PlottedPieces<FarmIndex>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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