pub enum DynFileSource {
FileReader(FileReader),
FileSource(FileSource),
Dead,
}Expand description
A runtime adapter of FileReader and FileSource,
also able to switch between the two mode of operations dynamically.
Variantsยง
FileReader(FileReader)
FileSource(FileSource)
Dead
If you encounter this, itโs a programming mistake
Implementationsยง
Sourceยงimpl DynFileSource
impl DynFileSource
pub async fn new( file_id: FileId, stype: FileSourceType, ) -> Result<Self, FileErr>
pub async fn seek(&mut self, to: SeqPos) -> Result<u64, FileErr>
pub fn source_type(&self) -> FileSourceType
Sourcepub async fn switch_to(self, stype: FileSourceType) -> Result<Self, FileErr>
pub async fn switch_to(self, stype: FileSourceType) -> Result<Self, FileErr>
Switch to a different mode of operation.
Warning: This future must not be canceled.
pub async fn end(self) -> AsyncFile
pub fn offset(&self) -> u64
pub fn file_size(&self) -> u64
pub fn is_dead(&self) -> bool
Trait Implementationsยง
Sourceยงimpl ByteSource for DynFileSource
impl ByteSource for DynFileSource
type Future<'a> = DynReadFuture<'a>
fn request_bytes(&mut self, size: usize) -> Self::Future<'_>
Auto Trait Implementationsยง
impl Freeze for DynFileSource
impl RefUnwindSafe for DynFileSource
impl Send for DynFileSource
impl Sync for DynFileSource
impl Unpin for DynFileSource
impl UnsafeUnpin for DynFileSource
impl UnwindSafe for DynFileSource
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
Mutably borrows from an owned value. Read more