Struct muse_channel::ValueSender
source · pub struct ValueSender { /* private fields */ }Expand description
A sender of [RootedValue]s to be received by one or more ValueReceivers.
Implementations§
source§impl ValueSender
impl ValueSender
sourcepub fn send(&self, value: RootedValue) -> Result<(), RootedValue>
pub fn send(&self, value: RootedValue) -> Result<(), RootedValue>
Pushes value to the queue for ValueReceivers to read from.
If this sender is for a bounded channel and the channel is full, this
function will block the current thread until space is available or it is
disconnected. Use send_async(value).await in async
code instead to ensure proper interaction with the async runtime.
§Errors
This function returns value if the channel is disconnected before
value can be pushed.
sourcepub fn try_send(&self, value: RootedValue) -> Result<(), TrySendError>
pub fn try_send(&self, value: RootedValue) -> Result<(), TrySendError>
Tries to push value to the queue for ValueReceivers to read from.
This function is safe to be invoked from both async and non-async code.
§Errors
TrySendError::Disconnected: All associatedValueReceivers have been dropped.TrySendError::Full: The value cannot be pushed due to the channel being full.
sourcepub fn send_async(&self, value: RootedValue) -> SendAsync<'_> ⓘ
pub fn send_async(&self, value: RootedValue) -> SendAsync<'_> ⓘ
Pushes value to the queue for ValueReceivers to read from.
If this sender is for a bounded channel and the channel is full, this function will block the current task until space is available or it is disconnected.
§Errors
This function returns value if the channel is disconnected before
value can be pushed.
sourcepub fn receivers(&self) -> usize
pub fn receivers(&self) -> usize
Returns the number of associated ValueReceivers that have not been
dropped.
sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if all associated ValueReceivers have been dropped.
Trait Implementations§
source§impl Clone for ValueSender
impl Clone for ValueSender
source§impl CustomType for ValueSender
impl CustomType for ValueSender
source§impl Debug for ValueSender
impl Debug for ValueSender
source§impl Drop for ValueSender
impl Drop for ValueSender
impl ContainsNoRefs for ValueSender
Auto Trait Implementations§
impl Freeze for ValueSender
impl !RefUnwindSafe for ValueSender
impl Send for ValueSender
impl Sync for ValueSender
impl Unpin for ValueSender
impl !UnwindSafe for ValueSender
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
§impl<A> Cast for A
impl<A> Cast for A
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)