pub struct FileReader { /* private fields */ }Expand description
Simple block-aligned source wrapper over std::fs::File.
Implementations§
Source§impl FileReader
impl FileReader
pub fn open(path: impl AsRef<Path>, block_size: u32) -> GibbloxResult<Self>
pub fn open_with_config(config: FileReaderConfig) -> GibbloxResult<Self>
pub fn from_file(file: File, block_size: u32) -> GibbloxResult<Self>
pub fn from_file_with_identity( file: File, block_size: u32, identity_path: String, ) -> GibbloxResult<Self>
pub fn from_file_with_config( file: File, config: FileReaderConfig, ) -> GibbloxResult<Self>
pub fn config(&self) -> &FileReaderConfig
pub fn size_bytes(&self) -> u64
Trait Implementations§
Source§impl BlockReader for FileReader
impl BlockReader for FileReader
Source§fn block_size(&self) -> u32
fn block_size(&self) -> u32
Logical block size in bytes.
Source§fn total_blocks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GibbloxResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn total_blocks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GibbloxResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Total number of logical blocks available.
Source§fn write_identity(&self, out: &mut dyn Write) -> Result
fn write_identity(&self, out: &mut dyn Write) -> Result
Write a stable, canonical identity string for this block reader.
Source§fn read_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
lba: u64,
buf: &'life1 mut [u8],
ctx: ReadContext,
) -> Pin<Box<dyn Future<Output = GibbloxResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
lba: u64,
buf: &'life1 mut [u8],
ctx: ReadContext,
) -> Pin<Box<dyn Future<Output = GibbloxResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl ByteReader for FileReader
impl ByteReader for FileReader
Source§fn size_bytes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GibbloxResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn size_bytes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = GibbloxResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Total source size in bytes.
Source§fn write_identity(&self, out: &mut dyn Write) -> Result
fn write_identity(&self, out: &mut dyn Write) -> Result
Write a stable, canonical identity string for this byte reader.
Auto Trait Implementations§
impl Freeze for FileReader
impl RefUnwindSafe for FileReader
impl Send for FileReader
impl Sync for FileReader
impl Unpin for FileReader
impl UnsafeUnpin for FileReader
impl UnwindSafe for FileReader
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