pub trait ReadAt: Send + Sync {
// Required methods
fn len(&self) -> Result<u64>;
fn read_at(&self, offset: u64, buffer: &mut [u8]) -> Result<usize>;
// Provided method
fn is_empty(&self) -> Result<bool> { ... }
}Expand description
Thread-safe positional compressed input.
Calls to ReadAt::read_at can occur concurrently and must not mutate a
shared stream cursor. Implementations may return short reads, but must not
return Ok(0) before the requested offset reaches ReadAt::len. The
reported length and every byte before it must remain stable for the complete
decode. Violating these requirements can cause an ordinary decoding error,
but cannot violate memory safety because the trait is safe.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".