Struct crux_core::bridge::BridgeWithSerializer

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

A bridge with a user supplied serializer

This is exactly the same as Bridge, except instead of using the default bincode serialization, you can provide your own [Serializer].

Warning: the support for custom serialization is experimental and does not have a corresponding type generation support - you will need to write deserialization code on the shell side yourself, or generate it using separate tooling.

Implementations§

source§

impl<Eff, A> BridgeWithSerializer<Eff, A>
where Eff: Effect, A: App,

source

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

source

pub fn process_event<'de, D, S>(&self, event: D, requests_out: S)
where for<'a> A::Event: Deserialize<'a>, D: Deserializer<'de> + 'de, S: Serializer,

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, D, S>(&self, id: u32, response: D, requests_out: S)
where for<'a> A::Event: Deserialize<'a>, D: Deserializer<'de>, S: Serializer,

Receive a response to a capability request from the shell.

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

source

pub fn view<S>(&self, ser: S)
where S: Serializer,

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

Auto Trait Implementations§

§

impl<Eff, A> !Freeze for BridgeWithSerializer<Eff, A>

§

impl<Eff, A> RefUnwindSafe for BridgeWithSerializer<Eff, A>

§

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

§

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

§

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

§

impl<Eff, A> UnwindSafe for BridgeWithSerializer<Eff, 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>,

§

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>,

§

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.