pub struct ValidatedMmap { /* private fields */ }Expand description
Validated memory-mapped region with bounds checking
All accesses are bounds-checked to prevent undefined behavior from corrupted or truncated files.
Implementations§
Source§impl ValidatedMmap
impl ValidatedMmap
Sourcepub fn open(
path: &Path,
config: ValidationConfig,
) -> Result<Self, ValidationError>
pub fn open( path: &Path, config: ValidationConfig, ) -> Result<Self, ValidationError>
Create a new ValidatedMmap with full validation
Sourcepub fn metadata(&self) -> &FileMetadata
pub fn metadata(&self) -> &FileMetadata
Get file metadata
Sourcepub fn get_edge(&self, index: usize) -> Result<EdgeRef<'_>, ValidationError>
pub fn get_edge(&self, index: usize) -> Result<EdgeRef<'_>, ValidationError>
Get a validated edge reference
Sourcepub fn slice(&self, range: Range<usize>) -> Result<&[u8], ValidationError>
pub fn slice(&self, range: Range<usize>) -> Result<&[u8], ValidationError>
Get a slice of the data with bounds checking
Sourcepub fn iter_edges(&self) -> ValidatedEdgeIterator<'_> ⓘ
pub fn iter_edges(&self) -> ValidatedEdgeIterator<'_> ⓘ
Iterate over all edges with validation
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Mark mmap as invalid (e.g., after detecting truncation)
Sourcepub fn verify_all(&self) -> Result<usize, ValidationError>
pub fn verify_all(&self) -> Result<usize, ValidationError>
Verify integrity of all edges
Auto Trait Implementations§
impl !Freeze for ValidatedMmap
impl RefUnwindSafe for ValidatedMmap
impl Send for ValidatedMmap
impl Sync for ValidatedMmap
impl Unpin for ValidatedMmap
impl UnwindSafe for ValidatedMmap
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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