Struct samply_symbols::FileContentsWrapper
source · pub struct FileContentsWrapper<T: FileContents> { /* private fields */ }Expand description
A wrapper for a FileContents object. The wrapper provides some convenience methods
and, most importantly, implements ReadRef for &FileContentsWrapper.
Implementations§
source§impl<T: FileContents> FileContentsWrapper<T>
impl<T: FileContents> FileContentsWrapper<T>
pub fn new(file_contents: T) -> Self
pub fn len(&self) -> u64
pub fn is_empty(&self) -> bool
pub fn read_bytes_at(
&self,
offset: u64,
size: u64
) -> FileAndPathHelperResult<&[u8]>
pub fn read_bytes_at_until(
&self,
range: Range<u64>,
delimiter: u8
) -> FileAndPathHelperResult<&[u8]>
sourcepub fn read_bytes_into(
&self,
buffer: &mut Vec<u8>,
offset: u64,
size: usize
) -> FileAndPathHelperResult<()>
pub fn read_bytes_into(
&self,
buffer: &mut Vec<u8>,
offset: u64,
size: usize
) -> FileAndPathHelperResult<()>
Append size bytes to buffer, starting to read at offset in the file.
If successful, buffer must have had its len increased exactly by size,
otherwise the caller may panic.
pub fn read_entire_data(&self) -> FileAndPathHelperResult<&[u8]>
pub fn full_range(&self) -> RangeReadRef<'_, &Self>
pub fn range(&self, start: u64, size: u64) -> RangeReadRef<'_, &Self>
Trait Implementations§
source§impl<T: FileContents> Debug for FileContentsWrapper<T>
impl<T: FileContents> Debug for FileContentsWrapper<T>
source§impl<'data, T: FileContents> ReadRef<'data> for &'data FileContentsWrapper<T>
impl<'data, T: FileContents> ReadRef<'data> for &'data FileContentsWrapper<T>
source§fn read_bytes_at(self, offset: u64, size: u64) -> Result<&'data [u8], ()>
fn read_bytes_at(self, offset: u64, size: u64) -> Result<&'data [u8], ()>
Get a reference to a
u8 slice at the given offset. Read moresource§fn read_bytes_at_until(
self,
range: Range<u64>,
delimiter: u8
) -> Result<&'data [u8], ()>
fn read_bytes_at_until(
self,
range: Range<u64>,
delimiter: u8
) -> Result<&'data [u8], ()>
Get a reference to a delimited
u8 slice which starts at range.start. Read moresource§fn read_bytes(self, offset: &mut u64, size: u64) -> Result<&'a [u8], ()>
fn read_bytes(self, offset: &mut u64, size: u64) -> Result<&'a [u8], ()>
Get a reference to a
u8 slice at the given offset, and update the offset. Read moresource§fn read<T>(self, offset: &mut u64) -> Result<&'a T, ()>where
T: Pod,
fn read<T>(self, offset: &mut u64) -> Result<&'a T, ()>where
T: Pod,
Get a reference to a
Pod type at the given offset, and update the offset. Read moresource§fn read_at<T>(self, offset: u64) -> Result<&'a T, ()>where
T: Pod,
fn read_at<T>(self, offset: u64) -> Result<&'a T, ()>where
T: Pod,
Get a reference to a
Pod type at the given offset. Read more