Skip to main content

Bridge

Trait Bridge 

Source
pub trait Bridge {
    // Required methods
    fn dispatch(&mut self, input: &[u8]) -> Vec<u8> ⓘ;
    fn pointer(&mut self, phase: u8, x: f32, y: f32, at_ms: f64) -> u32;
    fn view(&self, key: &str) -> Vec<u8> ⓘ;
    fn provide_blob(&mut self, name: &str, bytes: &[u8]) -> Vec<u8> ⓘ;
}
Expand description

The surface every bridge (UniFFI, wasm-bindgen, a test harness) wraps. Bytes in, bytes out.

Required Methods§

Source

fn dispatch(&mut self, input: &[u8]) -> Vec<u8> ⓘ

One protocol line in, one response out.

Source

fn pointer(&mut self, phase: u8, x: f32, y: f32, at_ms: f64) -> u32

Typed fast path, no JSON. Returns a bitmask: bit 0 = dirty views queued, bit 1 = effects pending.

Source

fn view(&self, key: &str) -> Vec<u8> ⓘ

The JSON of one view key (null when unknown).

Source

fn provide_blob(&mut self, name: &str, bytes: &[u8]) -> Vec<u8> ⓘ

Large binary input off the JSON path, named by the app.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A: App> Bridge for Runtime<A>