pub struct Reader<'a> { /* private fields */ }Expand description
Zero-copy reader for accessing region data from memory-mapped storage.
Holds locks on the memory map and region metadata during its lifetime, preventing concurrent modifications. Should be dropped as soon as reading is complete to avoid blocking writes.
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
pub fn new( mmap: RwLockReadGuard<'a, RawRwLock, MmapMut>, region_meta: RwLockReadGuard<'a, RawRwLock, RegionMetadata>, ) -> Reader<'a>
pub fn unchecked_read(&self, offset: u64, len: u64) -> &[u8] ⓘ
pub fn read(&self, offset: u64, len: u64) -> &[u8] ⓘ
pub fn read_all(&self) -> &[u8] ⓘ
pub fn prefixed(&self, offset: u64) -> &[u8] ⓘ
pub fn region_meta(&self) -> &RegionMetadata
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Reader<'a>
impl<'a> !RefUnwindSafe for Reader<'a>
impl<'a> !Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> !UnwindSafe for Reader<'a>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more