Struct web_audio_api::MessagePort
source · pub struct MessagePort<'a>(/* private fields */);
Expand description
One of the two ports of a message channel
Allowing messages to be sent from one port and listening out for them arriving at the other.
Implementations§
source§impl<'a> MessagePort<'a>
impl<'a> MessagePort<'a>
sourcepub fn post_message<M: Any + Send + 'static>(&self, msg: M)
pub fn post_message<M: Any + Send + 'static>(&self, msg: M)
Send a message from the port.
sourcepub fn set_onmessage<F: FnMut(Box<dyn Any + Send + 'static>) + Send + 'static>(
&self,
callback: F
)
pub fn set_onmessage<F: FnMut(Box<dyn Any + Send + 'static>) + Send + 'static>( &self, callback: F )
Register callback to run when a message arrives on the channel.
Only a single event handler is active at any time. Calling this method multiple times will override the previous event handler.
sourcepub fn clear_onmessage(&self)
pub fn clear_onmessage(&self)
Unset the callback to run when a message arrives on the channel.
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for MessagePort<'a>
impl<'a> Send for MessagePort<'a>
impl<'a> Sync for MessagePort<'a>
impl<'a> Unpin for MessagePort<'a>
impl<'a> UnwindSafe for MessagePort<'a>
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