pub struct EdgeRef<'a> { /* private fields */ }Expand description
A zero-copy reference to an edge stored in memory-mapped data.
This struct provides lazy field access directly from the underlying byte slice, avoiding the overhead of deserializing into an owned struct.
§Lifetime
The lifetime 'a is tied to the underlying memory-mapped region.
The EdgeRef is only valid as long as the mmap is valid.
Implementations§
Source§impl<'a> EdgeRef<'a>
impl<'a> EdgeRef<'a>
Sourcepub fn new(bytes: &'a [u8; 128]) -> Self
pub fn new(bytes: &'a [u8; 128]) -> Self
Create a new EdgeRef from a byte slice.
§Safety
The caller must ensure the slice is exactly 128 bytes and contains a valid edge representation.
Sourcepub fn try_from_slice(bytes: &'a [u8]) -> Option<Self>
pub fn try_from_slice(bytes: &'a [u8]) -> Option<Self>
Try to create an EdgeRef from a slice (with length check).
Sourcepub fn timestamp_us(&self) -> u64
pub fn timestamp_us(&self) -> u64
Get the timestamp in microseconds (u64 at offset 16).
Sourcepub fn project_id(&self) -> u16
pub fn project_id(&self) -> u16
Get the project ID (u16 at offset 32).
Sourcepub fn source_node_id(&self) -> u128
pub fn source_node_id(&self) -> u128
Get the source node ID (u128 at offset 34).
Sourcepub fn target_node_id(&self) -> u128
pub fn target_node_id(&self) -> u128
Get the target node ID (u128 at offset 50).
Sourcepub fn is_deleted(&self) -> bool
pub fn is_deleted(&self) -> bool
Check if this edge is a tombstone (deleted).
Sourcepub fn payload_ref(&self) -> &[u8] ⓘ
pub fn payload_ref(&self) -> &[u8] ⓘ
Get the payload reference (hash or inline data at offset 68).
Sourcepub fn verify_checksum(&self) -> bool
pub fn verify_checksum(&self) -> bool
Verify the edge checksum.
Trait Implementations§
Source§impl Ord for EdgeRef<'_>
impl Ord for EdgeRef<'_>
Source§impl PartialOrd for EdgeRef<'_>
impl PartialOrd for EdgeRef<'_>
impl<'a> Copy for EdgeRef<'a>
impl Eq for EdgeRef<'_>
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> UnwindSafe for EdgeRef<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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