Skip to main content

SharedHeader

Struct SharedHeader 

Source
pub struct SharedHeader<'a> { /* private fields */ }
Expand description

Accessor for a shared-memory ring header, for consumers that read the ring in place (zero-copy) without a Host handle — e.g. a foreign driver that holds a raw pointer to the shared linear memory.

Field offsets match [memory::OFF_*] constants and are part of the stable wire layout (see spec/OPCODE.md).

Implementations§

Source§

impl<'a> SharedHeader<'a>

Source

pub fn new(mem: &'a [u8]) -> Self

Wrap an immutable view of the shared linear memory.

Source

pub fn frame_count(&self) -> u32

frameCount — the completed-frame watermark.

Source

pub fn read_cursor(&self) -> u32

readCursor — the slot the consumer has consumed up to (masked).

Source

pub fn write_cursor(&self) -> u32

writeCursor — the slot the producer has written up to (masked).

Source

pub fn slot_count(&self) -> u32

slotCount — number of ring slots (power of two).

Source

pub fn ring_offset(&self) -> usize

Byte offset of the ring region within the linear memory.

Source

pub fn ring_bytes(&self) -> usize

Byte length of the ring region.

Source

pub fn arena_offset(&self) -> usize

Byte offset of the arena region within the linear memory.

Source

pub fn arena_cursor(&self) -> u32

Byte offset of the arena cursor.

Auto Trait Implementations§

§

impl<'a> Forget for SharedHeader<'a>

§

impl<'a> Freeze for SharedHeader<'a>

§

impl<'a> Move for SharedHeader<'a>

§

impl<'a> RefUnwindSafe for SharedHeader<'a>

§

impl<'a> Send for SharedHeader<'a>

§

impl<'a> Sync for SharedHeader<'a>

§

impl<'a> Unpin for SharedHeader<'a>

§

impl<'a> UnsafeUnpin for SharedHeader<'a>

§

impl<'a> UnwindSafe for SharedHeader<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.