pub trait CollectionParser: Send + Debug + Clone + 'static {
    // Required method
    fn parse<'a, R: AsyncSliceReader + 'a>(
        &'a self,
        format: u64,
        reader: R
    ) -> LocalBoxFuture<'a, Result<(Box<dyn LinkStream>, CollectionStats)>>;
}
Expand description

A custom collection parser that allows the user to define what a collection is.

A collection can be anything that contains an ordered sequence of blake3 hashes. Some collections store links with a fixed size and therefore allow efficient skipping. Others store links with a variable size and therefore only allow sequential access.

This API tries to accomodate both use cases. For collections that do not allow efficient random access, the LinkStream::skip method can be implemented by just repeatedly calling next.

For collections that do allow efficient random access, the LinkStream::skip method can be used to move some internal offset.

Required Methods§

source

fn parse<'a, R: AsyncSliceReader + 'a>( &'a self, format: u64, reader: R ) -> LocalBoxFuture<'a, Result<(Box<dyn LinkStream>, CollectionStats)>>

Parse a collection with this parser

Implementors§

source§

impl CollectionParser for NoCollectionParser

A CustomCollection for NoCollectionParser.

This is useful for when you don’t want to support collections at all.