pub struct EdgeRef<'a> { /* private fields */ }Expand description
Type-safe, bounds-checked edge reference
Instead of raw transmute, uses validated constructor with bounds check.
Implementations§
Source§impl<'a> EdgeRef<'a>
impl<'a> EdgeRef<'a>
Sourcepub fn new_checked(
data: &'a [u8],
offset: usize,
) -> Result<Self, ValidationError>
pub fn new_checked( data: &'a [u8], offset: usize, ) -> Result<Self, ValidationError>
Create a new EdgeRef with bounds and validity checking
Returns Err if:
- offset + EDGE_SIZE > data.len()
- Edge magic is invalid
- Edge CRC does not match
Sourcepub unsafe fn new_unchecked(data: &'a [u8], offset: usize) -> Self
pub unsafe fn new_unchecked(data: &'a [u8], offset: usize) -> Self
Create EdgeRef without validation (unsafe fast path)
§Safety
Caller must ensure:
- offset + EDGE_SIZE <= data.len()
- Edge data is valid
Sourcepub fn payload_bytes(&self) -> Result<&'a [u8], ValidationError>
pub fn payload_bytes(&self) -> Result<&'a [u8], ValidationError>
Get payload bytes with bounds validation
Payload is stored at variable offset within the edge
Sourcepub fn verify_crc(&self) -> bool
pub fn verify_crc(&self) -> bool
Verify edge CRC
Auto Trait Implementations§
impl<'a> Freeze for EdgeRef<'a>
impl<'a> RefUnwindSafe for EdgeRef<'a>
impl<'a> Send for EdgeRef<'a>
impl<'a> Sync for EdgeRef<'a>
impl<'a> Unpin for EdgeRef<'a>
impl<'a> UnsafeUnpin for EdgeRef<'a>
impl<'a> UnwindSafe for EdgeRef<'a>
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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