pub struct BridgeWithSerializer<A>where
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<A> BridgeWithSerializer<A>where
A: App,
impl<A> BridgeWithSerializer<A>where
A: App,
pub fn new(core: Core<A>) -> Self
Sourcepub fn process_event<'de, D, S>(
&self,
event: D,
requests_out: S,
) -> Result<(), BridgeError>
pub fn process_event<'de, D, S>( &self, event: D, requests_out: S, ) -> Result<(), BridgeError>
Receive an event from the shell.
The event
is serialized and will be deserialized by the core before it’s passed
to your app.
§Errors
Returns an error if the event could not be deserialized.
Sourcepub fn handle_response<'de, D, S>(
&self,
id: u32,
response: D,
requests_out: S,
) -> Result<(), BridgeError>
pub fn handle_response<'de, D, S>( &self, id: u32, response: D, requests_out: S, ) -> Result<(), BridgeError>
Sourcepub fn view<S>(&self, ser: S) -> Result<(), BridgeError>where
S: Serializer,
pub fn view<S>(&self, ser: S) -> Result<(), BridgeError>where
S: Serializer,
Get the current state of the app’s view model (serialized).
§Errors
Returns an error if the view model could not be serialized.
Auto Trait Implementations§
impl<A> !Freeze for BridgeWithSerializer<A>
impl<A> !RefUnwindSafe for BridgeWithSerializer<A>
impl<A> Send for BridgeWithSerializer<A>
impl<A> Sync for BridgeWithSerializer<A>
impl<A> Unpin for BridgeWithSerializer<A>
impl<A> !UnwindSafe for BridgeWithSerializer<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more