pub struct HostSender { /* private fields */ }Expand description
Sends events to the app that made one call or post
(HostCall::sender). Cheap to clone; usable from any thread.
Implementations§
Source§impl HostSender
impl HostSender
Sourcepub fn send(
&self,
name: impl Into<String>,
data: JsonValue,
) -> Result<bool, String>
pub fn send( &self, name: impl Into<String>, data: JsonValue, ) -> Result<bool, String>
Sends event name with data to the app that made the call
(host.on(name, listener), as HostChannel::send). Ok(false)
once that app stopped or another took the view: the event is
dropped, never kept for the next app. Ok(true) puts it on the
app’s queue; an app that stops before it reads the event drops it.
Err for a name that is empty or longer than
nsh_core::host_channel::MAX_NAME_LEN bytes.
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Whether the app that made the call stopped or was replaced: its events go nowhere from now on.
Sourcepub fn closed(&self) -> HostSenderClosed ⓘ
pub fn closed(&self) -> HostSenderClosed ⓘ
Resolves once the app that made the call stops or another app takes the view (at once if it already has). Any executor.
Trait Implementations§
Source§impl Clone for HostSender
impl Clone for HostSender
Source§impl Debug for HostSender
impl Debug for HostSender
Auto Trait Implementations§
impl Forget for HostSender
impl Freeze for HostSender
impl Move for HostSender
impl RefUnwindSafe for HostSenderwhere
Atomic<usize>: RefUnwindSafe,
Sender<Message>: RefUnwindSafe,
Atomic<bool>: RefUnwindSafe,
Mutex<(u64, HashMap<u64, Waker>)>: RefUnwindSafe,
impl Send for HostSender
impl Sync for HostSender
impl Unpin for HostSender
impl UnsafeUnpin for HostSender
impl UnwindSafe for HostSenderwhere
Arc<Caller>: UnwindSafe,
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