Struct crux_core::bridge::BridgeWithSerializer
source · pub struct BridgeWithSerializer<Eff, A>{ /* 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>
impl<Eff, A> BridgeWithSerializer<Eff, A>
pub fn new(core: Core<Eff, A>) -> Self
sourcepub fn process_event<'de, D, S>(&self, event: D, requests_out: S)
pub fn process_event<'de, D, S>(&self, event: D, requests_out: S)
Receive an event from the shell.
The event
is serialized and will be deserialized by the core before it’s passed
to your app.
sourcepub fn handle_response<'de, D, S>(&self, id: u32, response: D, requests_out: S)
pub fn handle_response<'de, D, S>(&self, id: u32, response: D, requests_out: S)
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.
sourcepub fn view<S>(&self, ser: S)where
S: Serializer,
pub fn view<S>(&self, ser: S)where
S: Serializer,
Get the current state of the app’s view model (serialized).