Struct crux_core::bridge::Bridge

source ·
pub struct Bridge<Eff, A>where
    Eff: Effect,
    A: App,{ /* private fields */ }
Expand description

Bridge is a core wrapper presenting the same interface as the Core but in a serialized form

Implementations§

source§

impl<Eff, A> Bridge<Eff, A>where Eff: Effect + Send + 'static, A: App,

source

pub fn new(core: Core<Eff, A>) -> Self

Create a new Bridge using the provided core.

source

pub fn process_event<'de>(&self, event: &'de [u8]) -> Vec<u8>where A::Event: Deserialize<'de>,

Receive an event from the shell.

The event is serialized and will be deserialized by the core before it’s passed to your app.

source

pub fn handle_response<'de>(&self, uuid: &[u8], output: &'de [u8]) -> Vec<u8>where A::Event: Deserialize<'de>,

Receive a response to a capability request from the shell.

The output is serialized capability output. It will be deserialized by the core. The uuid MUST match the uuid of the effect that triggered it, else the core will panic.

source

pub fn view(&self) -> Vec<u8>

Get the current state of the app’s view model (serialized).

Auto Trait Implementations§

§

impl<Eff, A> RefUnwindSafe for Bridge<Eff, A>where A: RefUnwindSafe, <A as App>::Capabilities: RefUnwindSafe,

§

impl<Eff, A> Send for Bridge<Eff, A>where A: Send, <A as App>::Capabilities: Send, <A as App>::Model: Send,

§

impl<Eff, A> Sync for Bridge<Eff, A>where A: Sync, <A as App>::Capabilities: Sync, <A as App>::Model: Send + Sync,

§

impl<Eff, A> Unpin for Bridge<Eff, A>where A: Unpin, Eff: Unpin, <A as App>::Capabilities: Unpin, <A as App>::Event: Unpin, <A as App>::Model: Unpin,

§

impl<Eff, A> UnwindSafe for Bridge<Eff, A>where A: UnwindSafe, <A as App>::Capabilities: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.