subspace_farmer_components

Trait PieceGetter

source
pub trait PieceGetter {
    // Required methods
    fn get_piece<'life0, 'async_trait>(
        &'life0 self,
        piece_index: PieceIndex,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Piece>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_pieces<'a, 'async_trait, PieceIndices>(
        &'a self,
        piece_indices: PieceIndices,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = (PieceIndex, Result<Option<Piece>>)> + Send + Unpin + 'a>>> + Send + 'async_trait>>
       where PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a + 'async_trait,
             Self: 'async_trait,
             'a: 'async_trait;
}
Expand description

Trait representing a way to get pieces

Required Methods§

source

fn get_piece<'life0, 'async_trait>( &'life0 self, piece_index: PieceIndex, ) -> Pin<Box<dyn Future<Output = Result<Option<Piece>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get piece by index

source

fn get_pieces<'a, 'async_trait, PieceIndices>( &'a self, piece_indices: PieceIndices, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = (PieceIndex, Result<Option<Piece>>)> + Send + Unpin + 'a>>> + Send + 'async_trait>>
where PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a + 'async_trait, Self: 'async_trait, 'a: 'async_trait,

Get pieces with provided indices.

Number of elements in returned stream is the same as number of unique piece_indices.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl PieceGetter for ArchivedHistorySegment

source§

fn get_piece<'life0, 'async_trait>( &'life0 self, piece_index: PieceIndex, ) -> Pin<Box<dyn Future<Output = Result<Option<Piece>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn get_pieces<'a, 'async_trait, PieceIndices>( &'a self, piece_indices: PieceIndices, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = (PieceIndex, Result<Option<Piece>>)> + Send + Unpin + 'a>>> + Send + 'async_trait>>
where PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a + 'async_trait, Self: 'async_trait, 'a: 'async_trait,

source§

impl<T> PieceGetter for Arc<T>
where T: PieceGetter + Send + Sync,

source§

fn get_piece<'life0, 'async_trait>( &'life0 self, piece_index: PieceIndex, ) -> Pin<Box<dyn Future<Output = Result<Option<Piece>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn get_pieces<'a, 'async_trait, PieceIndices>( &'a self, piece_indices: PieceIndices, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = (PieceIndex, Result<Option<Piece>>)> + Send + Unpin + 'a>>> + Send + 'async_trait>>
where PieceIndices: IntoIterator<Item = PieceIndex, IntoIter: Send> + Send + 'a + 'async_trait, Self: 'async_trait, 'a: 'async_trait,

Implementors§