pub trait Source {
// Required methods
fn len(&self) -> u64;
fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<usize, SourceError>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Random-access bytes a document is read from.
Core crates never open files or sockets themselves (docs/PLAN.md §2, “No
ambient I/O”); the caller hands them a Source backed by memory, a file,
or anything else that can serve ranges.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".