Skip to main content

AsyncBytesPartialDecoderTraits

Trait AsyncBytesPartialDecoderTraits 

Source
pub trait AsyncBytesPartialDecoderTraits:
    Any
    + Send
    + Sync {
    // Required methods
    fn exists<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn size_held(&self) -> usize;
    fn partial_decode_many<'a, 'life0, 'async_trait>(
        &'a self,
        decoded_regions: Box<dyn MaybeSendByteRangeIterator<Item = ByteRange> + 'a>,
        options: &'life0 CodecOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Cow<'a, [u8]>>>, CodecError>> + Send + 'async_trait>>
       where 'a: 'async_trait,
             'life0: 'async_trait,
             Self: 'async_trait;
    fn supports_partial_decode(&self) -> bool;

    // Provided methods
    fn partial_decode<'a, 'life0, 'async_trait>(
        &'a self,
        decoded_region: ByteRange,
        options: &'life0 CodecOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Cow<'a, [u8]>>, CodecError>> + Send + 'async_trait>>
       where 'a: 'async_trait,
             'life0: 'async_trait,
             Self: Sync + 'async_trait { ... }
    fn decode<'a, 'life0, 'async_trait>(
        &'a self,
        options: &'life0 CodecOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Cow<'a, [u8]>>, CodecError>> + Send + 'async_trait>>
       where 'a: 'async_trait,
             'life0: 'async_trait,
             Self: Sync + 'async_trait { ... }
}
Available on crate feature async only.
Expand description

Asynchronous partial bytes decoder traits.

Required Methods§

Source

fn exists<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns whether the chunk exists.

§Errors

Returns StorageError if a storage operation fails.

Source

fn size_held(&self) -> usize

Returns the size of chunk bytes held by the partial decoder.

Intended for use by size-constrained partial decoder caches.

Source

fn partial_decode_many<'a, 'life0, 'async_trait>( &'a self, decoded_regions: Box<dyn MaybeSendByteRangeIterator<Item = ByteRange> + 'a>, options: &'life0 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Cow<'a, [u8]>>>, CodecError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: 'async_trait,

Partially decode byte ranges.

Returns None if partial decoding of the input handle returns None.

§Errors

Returns CodecError if a codec fails or a byte range is invalid.

Source

fn supports_partial_decode(&self) -> bool

Returns whether this decoder supports partial decoding.

If this returns true, the decoder can efficiently handle partial decoding operations. If this returns false, partial decoding will fall back to a full decode operation.

Provided Methods§

Source

fn partial_decode<'a, 'life0, 'async_trait>( &'a self, decoded_region: ByteRange, options: &'life0 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<Cow<'a, [u8]>>, CodecError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Partially decode a byte range.

Returns None if partial decoding of the input handle returns None.

§Errors

Returns CodecError if a codec fails or the byte range is invalid.

Source

fn decode<'a, 'life0, 'async_trait>( &'a self, options: &'life0 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<Cow<'a, [u8]>>, CodecError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Decode all bytes.

Returns None if partial decoding of the input handle returns None.

§Errors

Returns CodecError if a codec fails.

Implementations on Foreign Types§

Source§

impl AsyncBytesPartialDecoderTraits for Cow<'static, [u8]>

Source§

fn exists<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Cow<'static, [u8]>: 'async_trait,

Source§

fn size_held(&self) -> usize

Source§

fn partial_decode_many<'a, 'life0, 'async_trait>( &'a self, decoded_regions: Box<dyn MaybeSendByteRangeIterator<Item = ByteRange> + 'a>, _parallel: &'life0 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Cow<'a, [u8]>>>, CodecError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Cow<'static, [u8]>: 'async_trait,

Source§

fn supports_partial_decode(&self) -> bool

Source§

impl AsyncBytesPartialDecoderTraits for Vec<u8>

Source§

fn exists<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Vec<u8>: 'async_trait,

Source§

fn size_held(&self) -> usize

Source§

fn partial_decode_many<'a, 'life0, 'async_trait>( &'a self, decoded_regions: Box<dyn MaybeSendByteRangeIterator<Item = ByteRange> + 'a>, _parallel: &'life0 CodecOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Cow<'a, [u8]>>>, CodecError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Vec<u8>: 'async_trait,

Source§

fn supports_partial_decode(&self) -> bool

Implementors§