pub trait Fetch:
Send
+ Sync
+ Debug {
// Required method
fn fetch(&self) -> Result<Bytes, Error>;
// Provided methods
fn fetch_with_reader(&self) -> Result<(Bytes, ReaderKind), Error> { ... }
fn size_hint(&self) -> Option<u64> { ... }
}Expand description
Bytes the caller fetches on demand (a batch engine’s mmap or object store).
Required Methods§
Sourcefn fetch(&self) -> Result<Bytes, Error>
fn fetch(&self) -> Result<Bytes, Error>
The file’s bytes. A fetcher of a load the Environment makes itself
(an Environment::load_dependency, any load of a source the
resolver returned, whether it is listed as a dependency or not, or a
reopen after an eviction; review round 12: a resolver’s load listed
as no dependency was not retried) that takes them from the
dependency pool may refuse with the pool’s refusal (Error::Budget naming
crate::budget::Reservation::Dependency): the Environment then
evicts the other dependencies and fetches once more, as for a
refusal of its own (plan section 3.13), whatever the fetcher did
before it returned the refusal: a refusal it passes on from a call of
its own into the Environment, which that call already retried, is
fetched once more too, since the core cannot tell it from the
fetcher’s own (registry::from_callers). A caller’s
Environment::load is no dependency’s, and returns such a refusal
as it is.
Provided Methods§
Sourcefn fetch_with_reader(&self) -> Result<(Bytes, ReaderKind), Error>
fn fetch_with_reader(&self) -> Result<(Bytes, ReaderKind), Error>
Fetch bytes together with their reader rules. The default is the memory reader; descriptor-backed fetchers can preserve path semantics. Joined split files must continue to use the memory reader.
Sourcefn size_hint(&self) -> Option<u64>
fn size_hint(&self) -> Option<u64>
Its size, when known without fetching. A size above
Limits::max_input_bytes refuses the source before it is fetched
(LimitKind::InputBytes, the size stated as its value), whatever
the fetch would return; the bytes a fetch returns are checked against
the bound whatever was stated (the Source docs).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".