Skip to main content

Host

Struct Host 

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

Consumer side: the host renderer reading completed frames.

SPSC contract: the host never reads past the producer’s published writeCursor, and the producer never overwrites an unconsumed readCursor. If the host is slow, multiple produced frames are coalesced into one Frame (opcodes remain in order); the frameCount simply signals “new data”.

Implementations§

Source§

impl<'a> Host<'a>

Source

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

Create a host view over the linear memory.

Source

pub fn frame_count(&self) -> u32

Total frames produced by the guest (for diagnostics).

Source

pub fn frames(&mut self) -> Vec<Frame<'a>>

Consume all frames produced since the last call, advancing readCursor.

Returns at most one Frame (all new opcodes since the last drain). If the producer produced multiple frames before this call they coalesce.

Source

pub fn send_event(&mut self, event: &Event) -> Result<(), RingError>

Write a raw-input event (host → guest) into the event ring, encoded as a 16-byte EVENT opcode. The renderer reports inputs here; the guest drains them via Guest::drain_events.

TextChanged text and Navigate URLs are bump-allocated into the host → guest event arena and referenced by their absolute offset in B (the SET_TEXT shared-memory convention); the guest resolves them from the same region. If the event arena is full the event is rejected with RingError::Full (backpressure).

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for Host<'a>

§

impl<'a> Forget for Host<'a>

§

impl<'a> Freeze for Host<'a>

§

impl<'a> RefUnwindSafe for Host<'a>

§

impl<'a> Send for Host<'a>

§

impl<'a> Sync for Host<'a>

§

impl<'a> Unpin for Host<'a>

§

impl<'a> UnsafeUnpin for Host<'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.