Skip to main content

ChunkGet

Trait ChunkGet 

Source
pub trait ChunkGet<const BODY_SIZE: usize = DEFAULT_BODY_SIZE>: Send + Sync {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn get(
        &self,
        address: &ChunkAddress,
    ) -> impl Future<Output = Result<AnyChunk<BODY_SIZE>, Self::Error>> + Send;
}
Expand description

Async chunk retrieval (primary API).

Types implementing SyncChunkGet + Send + Sync get this automatically via a blanket impl. Types needing genuinely async retrieval (e.g. network fetch) should implement ChunkGet directly without implementing SyncChunkGet.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Error type for get operations.

Required Methods§

Source

fn get( &self, address: &ChunkAddress, ) -> impl Future<Output = Result<AnyChunk<BODY_SIZE>, Self::Error>> + Send

Get a chunk by address.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, const BS: usize> ChunkGet<BS> for T
where T: SyncChunkGet<BS> + Send + Sync,

Source§

type Error = <T as SyncChunkGet<BS>>::Error