Skip to main content

Content

Trait Content 

Source
pub trait Content {
    // Required methods
    fn metadata(&self) -> ContentMetadata;
    fn open(&self) -> ContentFuture<'_, Result<ContentReaderRef, ContentError>>;

    // Provided method
    fn read_all(&self) -> ContentFuture<'_, Result<Vec<u8>, ContentError>> { ... }
}
Expand description

One readable piece of content from any source.

Required Methods§

Source

fn metadata(&self) -> ContentMetadata

What the provider states about this content without reading it.

Source

fn open(&self) -> ContentFuture<'_, Result<ContentReaderRef, ContentError>>

Opens a chunked reader over the bytes.

Provided Methods§

Source

fn read_all(&self) -> ContentFuture<'_, Result<Vec<u8>, ContentError>>

Reads every byte. The default drains open; providers already holding the bytes override it to avoid the copy.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§