Enum iroh_bytes::store::flat::MemOrFile
source · pub enum MemOrFile {
Mem(Bytes),
File(File),
}Expand description
A reader for either a file or a byte slice.
This is used to read small data from memory, and large data from disk.
Variants§
Trait Implementations§
source§impl AsyncSliceReader for MemOrFile
impl AsyncSliceReader for MemOrFile
§type ReadAtFuture<'a> = Either<<Bytes as AsyncSliceReader>::ReadAtFuture<'a>, <File as AsyncSliceReader>::ReadAtFuture<'a>>
type ReadAtFuture<'a> = Either<<Bytes as AsyncSliceReader>::ReadAtFuture<'a>, <File as AsyncSliceReader>::ReadAtFuture<'a>>
The future returned by read_at
source§fn read_at(&mut self, offset: u64, len: usize) -> Self::ReadAtFuture<'_>
fn read_at(&mut self, offset: u64, len: usize) -> Self::ReadAtFuture<'_>
Read the entire buffer at the given position. Read more
§type LenFuture<'a> = Either<<Bytes as AsyncSliceReader>::LenFuture<'a>, <File as AsyncSliceReader>::LenFuture<'a>>
type LenFuture<'a> = Either<<Bytes as AsyncSliceReader>::LenFuture<'a>, <File as AsyncSliceReader>::LenFuture<'a>>
The future returned by len
Auto Trait Implementations§
impl RefUnwindSafe for MemOrFile
impl Send for MemOrFile
impl Sync for MemOrFile
impl Unpin for MemOrFile
impl UnwindSafe for MemOrFile
Blanket Implementations§
source§impl<T> AsyncSliceReaderExt for Twhere
T: AsyncSliceReader,
impl<T> AsyncSliceReaderExt for Twhere
T: AsyncSliceReader,
source§fn read_to_end(&mut self) -> Self::ReadAtFuture<'_>
fn read_to_end(&mut self) -> Self::ReadAtFuture<'_>
Read the entire resource into a bytes::Bytes buffer, if possible.
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