#[non_exhaustive]pub struct HostCall { /* private fields */ }Expand description
A call (host.call(name, data)) or a post (host.post(name, data)) of
the app, as the embedding app’s handler gets it. A call is answered once,
from any thread; dropped unanswered, it fails in the app.
Implementations§
Source§impl HostCall
impl HostCall
Sourcepub fn resolve(self, value: JsonValue)
pub fn resolve(self, value: JsonValue)
Answers the call: the app’s promise resolves with value.
Sourcepub fn reject(self, message: impl Into<String>)
pub fn reject(self, message: impl Into<String>)
Fails the call: the app’s promise rejects with an Error of
message.
Sourcepub fn reply(self, result: Result<JsonValue, String>)
pub fn reply(self, result: Result<JsonValue, String>)
Answers the call with result (HostCall::resolve,
HostCall::reject).
Sourcepub fn into_reply(self) -> Option<HostReply>
pub fn into_reply(self) -> Option<HostReply>
The reply alone, to answer from elsewhere (None for a post).
Trait Implementations§
Auto Trait Implementations§
impl Forget for HostCall
impl Freeze for HostCall
impl Move for HostCall
impl RefUnwindSafe for HostCall
impl Send for HostCall
impl Sync for HostCall
impl Unpin for HostCall
impl UnsafeUnpin for HostCall
impl UnwindSafe for HostCall
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