pub struct SourceReader { /* private fields */ }Expand description
A detached reader over the server’s byte sources, for code that needs raw
bytes away from the ECS: the bundles, then every registered
AssetSource, then the filesystem. Kind-agnostic - no decoder runs and
no cache is touched - so any plugin or runtime module that loads its own
data (media files, archives, anything it ships with the app) reads
through the same chain the asset pipeline uses instead of the raw
filesystem.
Get one from crate::AssetServer::source_reader. The reader is a cheap
snapshot: Send + Sync, safe to move to another thread, and free to
block there (an archive read is a copy, a filesystem read is I/O). It
does not follow later registrations - a source or bundle registered after
the snapshot is invisible to it - so take a fresh reader per request
rather than holding one for the app’s lifetime.
The reader resolves the path it is given. Callers keep the same
conventions the rest of the pipeline uses: resolve app-relative paths
first (lumen_core::app_paths::resolve), and pass lumen://app/...
URIs through untouched - the bundle source claims those itself.
Implementations§
Trait Implementations§
Source§impl Clone for SourceReader
impl Clone for SourceReader
Source§fn clone(&self) -> SourceReader
fn clone(&self) -> SourceReader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more