pub struct Bridge<A, F = BincodeFfiFormat>{ /* private fields */ }Expand description
Bridge is a core wrapper presenting the same interface as the Core but in a
serialized form, using bincode as the serialization format.
Implementations§
Source§impl<A, Format> Bridge<A, Format>
impl<A, Format> Bridge<A, Format>
Sourcepub fn process_event(
&self,
event: &[u8],
) -> Result<Vec<u8>, BridgeError<Format>>
👎Deprecated since 0.17.0: Bridge API returning vectors has been deprecated. Please use the ‘update’ method.
pub fn process_event( &self, event: &[u8], ) -> Result<Vec<u8>, BridgeError<Format>>
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 update<'a>(
&self,
event: &'a [u8],
requests_out: &mut Vec<u8>,
) -> Result<(), BridgeError<Format>>
pub fn update<'a>( &self, event: &'a [u8], requests_out: &mut Vec<u8>, ) -> Result<(), BridgeError<Format>>
Send 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(
&self,
id: u32,
output: &[u8],
) -> Result<Vec<u8>, BridgeError<Format>>
👎Deprecated since 0.17.0: Bridge API returning vectors has been deprecated. Please use the ‘resolve’ method.
pub fn handle_response( &self, id: u32, output: &[u8], ) -> Result<Vec<u8>, BridgeError<Format>>
Sourcepub fn resolve<'a>(
&self,
id: EffectId,
response: &'a [u8],
requests_out: &mut Vec<u8>,
) -> Result<(), BridgeError<Format>>
pub fn resolve<'a>( &self, id: EffectId, response: &'a [u8], requests_out: &mut Vec<u8>, ) -> Result<(), BridgeError<Format>>
Provide a response to a capability request to resolve it and continue the corresponding command.
The output is serialized capability output. It will be deserialized by the core.
§Errors
Returns an error if the response could not be deserialized.
§Panics
The id MUST match the id of the effect that triggered it, else the core will panic.