pub trait ByteSource: Send + Sync {
// Required methods
fn len(&self) -> Option<u64>;
fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<usize, Error>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Re-export framework services (HTTP, URI, etc.) from the dedicated services crate. Random-access source of bytes the app is willing to serve.
Implementations are Send + Sync so the server can read from a worker
thread. A non-seekable backing store (e.g. a streamed content:// document)
should spool internally so read_at still answers arbitrary offsets.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".