pub struct StreamingAssetReader<R> { /* private fields */ }Expand description
A BundledAssetReader over any byte stream.
Every backend that streams an asset ends at the same loop: fill a chunk, stop at the end, name the asset rather than its resolved location when the read fails. What differs is only what was opened — a file beside the executable, a file in an application bundle, a span of an Android package, or bytes already in hand — and whether the asset ends where its stream does. The loop lives here once; a backend supplies the stream and, when its asset is a span of something larger, how many bytes of it are its own.
Implementations§
Source§impl<R> StreamingAssetReader<R>
impl<R> StreamingAssetReader<R>
Sourcepub fn new(path: impl Into<String>, source: R) -> StreamingAssetReader<R>
pub fn new(path: impl Into<String>, source: R) -> StreamingAssetReader<R>
A reader over a stream whose end is the asset’s end.
Sourcepub fn with_length(
path: impl Into<String>,
source: R,
len: u64,
) -> StreamingAssetReader<R>
pub fn with_length( path: impl Into<String>, source: R, len: u64, ) -> StreamingAssetReader<R>
A reader over len bytes of a stream that continues past the asset —
an Android package’s file descriptor addresses the whole package, so
the asset’s end is a count rather than end of file.
Trait Implementations§
Source§impl<R> BundledAssetReader for StreamingAssetReader<R>
impl<R> BundledAssetReader for StreamingAssetReader<R>
Source§fn read_chunk(&mut self) -> Result<Option<Vec<u8>>, BundledAssetError>
fn read_chunk(&mut self) -> Result<Option<Vec<u8>>, BundledAssetError>
None at end of asset.Auto Trait Implementations§
impl<R> Freeze for StreamingAssetReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for StreamingAssetReader<R>where
R: RefUnwindSafe,
impl<R> Send for StreamingAssetReader<R>where
R: Send,
impl<R> Sync for StreamingAssetReader<R>where
R: Sync,
impl<R> Unpin for StreamingAssetReader<R>where
R: Unpin,
impl<R> UnsafeUnpin for StreamingAssetReader<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for StreamingAssetReader<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.