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>
impl<'a> Host<'a>
Sourcepub fn new(mem: &'a mut [u8], layout: &MemoryLayout) -> Self
pub fn new(mem: &'a mut [u8], layout: &MemoryLayout) -> Self
Create a host view over the linear memory.
Sourcepub fn frame_count(&self) -> u32
pub fn frame_count(&self) -> u32
Total frames produced by the guest (for diagnostics).
Sourcepub fn frames(&mut self) -> Vec<Frame<'a>>
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.
Sourcepub fn send_event(&mut self, event: &Event) -> Result<(), RingError>
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).