Struct StatusBridge

Source
pub struct StatusBridge { /* private fields */ }
Expand description

Fixed retained storage, no allocations during ordinary publication. See module example for complete usage. O(128² + 128×1025 + MAX_WIRE_BYTES) bounded work; labels are measured by byte length without scanning oversized source text.

Implementations§

Source§

impl StatusBridge

Source

pub fn new(owner: u64) -> Result<StatusBridge, StatusError>

Start an unpublished bridge. No default snapshot or browser adoption.

use ferravex_render::{status::*, ui::*};
let mut ui = Ui::new();
ui.set_inspection_enabled(true);
ui.begin(Viewport::responsive([640., 480.], [0.; 4]).unwrap());
ui.button(7, UiRect { min: [20.; 2], size: [160., 48.] },
    "Resume", true, ButtonStyle::default()).unwrap();
ui.finish(false); // No input requested by this headless recipe.
let mappings = [UiAction { widget_id: 7, status_id: 20 }];
let mut status = StatusBridge::new(100)?;
status.publish(Some(StatusFacts { items: &[], ui: ui.inspect(),
    ui_actions: &mappings }))?;
let mut output = [0; 1024];
let length = status.write(&mut output)?;
assert!(std::str::from_utf8(&output[..length]).unwrap().contains("Resume"));
status.reset()?;
assert!(status.bytes().is_empty());
Source

pub fn publish( &mut self, facts: Option<StatusFacts<'_>>, ) -> Result<StatusUpdate, StatusError>

Validate the entire bounded source before replacing publication. Rejects duplicates even in the omitted suffix. At most one lifecycle and result. UI maps select only registered, enabled, clipped-in buttons; absent/disabled buttons are unavailable actions, not truncation. Missing full labels count as omissions; their painter abbreviation is never substituted.

Source

pub fn bytes(&self) -> &[u8] ⓘ

Current initialized JSON prefix only; empty before publish/after reset.

Source

pub fn write(&self, output: &mut [u8]) -> Result<usize, StatusError>

Atomic caller-buffer copy; tail is untouched and never part of the wire.

Source

pub fn reset(&mut self) -> Result<(), StatusError>

New epoch; same owner and storage. Call publish_browser again if adopted so readers see unavailable until the next complete publication.

Source

pub fn publish_browser(&self) -> Result<(), StatusError>

Explicit copy to this thread’s readonly export slot. Another owner must clear its slot before replacement. Repeated identical copies are no-ops. Host must call clear_browser on teardown; this does not retain self.

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.