Trait Chunk

Source
pub trait Chunk:
    Deref<Target = [u8]>
    + Send
    + Sync {
    // Required methods
    fn get_chunk_meta(&self) -> ChunkMeta;
    fn get_len(&self) -> usize;
    fn into_vec(self: Box<Self>) -> Vec<u8> ;
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        buf: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = BuckyResult<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn seek<'life0, 'async_trait>(
        &'life0 mut self,
        pos: SeekFrom,
    ) -> Pin<Box<dyn Future<Output = BuckyResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn calculate_id(&self) -> ChunkId { ... }
}

Required Methods§

Source

fn get_chunk_meta(&self) -> ChunkMeta

Source

fn get_len(&self) -> usize

Source

fn into_vec(self: Box<Self>) -> Vec<u8>

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 mut self, buf: &'life1 mut [u8], ) -> Pin<Box<dyn Future<Output = BuckyResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn seek<'life0, 'async_trait>( &'life0 mut self, pos: SeekFrom, ) -> Pin<Box<dyn Future<Output = BuckyResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Implementors§