pub struct MessageDescriptor {
pub region: RegionHandle,
pub offset: u64,
pub length: u32,
/* private fields */
}Expand description
A zero-copy message descriptor.
Instead of copying message data into the ring buffer, a descriptor references data in a shared region. The receiver reads directly from the shared region using the offset and length.
§TOCTOU Protection
Only Immutable or AppendOnly regions can use descriptors (ADR-087 Section 20.5). This prevents time-of-check-to-time-of-use attacks where a sender modifies shared data after the receiver reads the descriptor but before processing.
Fields§
§region: RegionHandleHandle to the shared region containing the data.
offset: u64Byte offset within the region.
length: u32Length in bytes.
Implementations§
Source§impl MessageDescriptor
impl MessageDescriptor
Sourcepub const fn new(region: RegionHandle, offset: u64, length: u32) -> Self
pub const fn new(region: RegionHandle, offset: u64, length: u32) -> Self
Create a new message descriptor.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Check if this descriptor is valid (non-null region, non-zero length).
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<Self>
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
Create from bytes read from ring buffer.
Trait Implementations§
Source§impl Clone for MessageDescriptor
impl Clone for MessageDescriptor
Source§fn clone(&self) -> MessageDescriptor
fn clone(&self) -> MessageDescriptor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageDescriptor
impl Debug for MessageDescriptor
Source§impl PartialEq for MessageDescriptor
impl PartialEq for MessageDescriptor
impl Copy for MessageDescriptor
impl Eq for MessageDescriptor
impl StructuralPartialEq for MessageDescriptor
Auto Trait Implementations§
impl Freeze for MessageDescriptor
impl RefUnwindSafe for MessageDescriptor
impl Send for MessageDescriptor
impl Sync for MessageDescriptor
impl Unpin for MessageDescriptor
impl UnsafeUnpin for MessageDescriptor
impl UnwindSafe for MessageDescriptor
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