pub struct Cx<E> { /* private fields */ }Expand description
Effects an app requests during update, generic over the app event type so
continuations stay fully typed.
Implementations§
Source§impl<E> Cx<E>
impl<E> Cx<E>
Sourcepub fn notify(
&mut self,
plugin: impl Into<String>,
op: impl Into<String>,
input: impl Into<String>,
)
pub fn notify( &mut self, plugin: impl Into<String>, op: impl Into<String>, input: impl Into<String>, )
Fire-and-forget call to a native plugin.
Sourcepub fn plugin(
&mut self,
plugin: impl Into<String>,
op: impl Into<String>,
input: impl Into<String>,
then: impl FnOnce(PluginResponse) -> E + Send + 'static,
)
pub fn plugin( &mut self, plugin: impl Into<String>, op: impl Into<String>, input: impl Into<String>, then: impl FnOnce(PluginResponse) -> E + Send + 'static, )
Request/response call: when the plugin replies, then(response) produces
the typed event delivered back to your update.
Sourcepub fn save(&mut self, data: impl Into<String>)
pub fn save(&mut self, data: impl Into<String>)
Persist data (handed back to MobilerApp::restore on next startup).
Sourcepub fn http(
&mut self,
method: impl Into<String>,
url: impl Into<String>,
body: Option<String>,
then: impl FnOnce(PluginResponse) -> E + Send + 'static,
)
pub fn http( &mut self, method: impl Into<String>, url: impl Into<String>, body: Option<String>, then: impl FnOnce(PluginResponse) -> E + Send + 'static, )
Perform an HTTP request via the shell’s built-in http capability. When it
completes, then(response) produces the typed event delivered back to
update — response.output is the body, response.ok is success (2xx).
Rides the request/response plugin mechanism, so it resolves asynchronously.
Sourcepub fn get(
&mut self,
url: impl Into<String>,
then: impl FnOnce(PluginResponse) -> E + Send + 'static,
)
pub fn get( &mut self, url: impl Into<String>, then: impl FnOnce(PluginResponse) -> E + Send + 'static, )
GET url, delivering the response to then.
Sourcepub fn post(
&mut self,
url: impl Into<String>,
body: impl Into<String>,
then: impl FnOnce(PluginResponse) -> E + Send + 'static,
)
pub fn post( &mut self, url: impl Into<String>, body: impl Into<String>, then: impl FnOnce(PluginResponse) -> E + Send + 'static, )
POST url with a JSON body, delivering the response to then.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for Cx<E>
impl<E> !RefUnwindSafe for Cx<E>
impl<E> Send for Cx<E>
impl<E> !Sync for Cx<E>
impl<E> Unpin for Cx<E>
impl<E> UnsafeUnpin for Cx<E>
impl<E> !UnwindSafe for Cx<E>
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