pub struct MessagePortSynchronousProxy { /* private fields */ }
Implementations§
Source§impl MessagePortSynchronousProxy
impl MessagePortSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<MessagePortEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<MessagePortEvent, Error>
Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.
Sourcepub fn post_message(
&self,
message: WebMessage,
___deadline: MonotonicInstant,
) -> Result<MessagePortPostMessageResult, Error>
pub fn post_message( &self, message: WebMessage, ___deadline: MonotonicInstant, ) -> Result<MessagePortPostMessageResult, Error>
Sends a WebMessage
to the peer. These are processed in order, one at a
time. It is not necessary for the caller to wait for the completion callback before calling
[MessagePort.PostMessage
] again.
If an error occurred, the FrameError
will be set to one of these value:
BUFFER_NOT_UTF8
: The script inmessage
’sdata
property is not UTF-8 encoded.NO_DATA_IN_MESSAGE
: Thedata
property is missing inmessage
.
Sourcepub fn receive_message(
&self,
___deadline: MonotonicInstant,
) -> Result<WebMessage, Error>
pub fn receive_message( &self, ___deadline: MonotonicInstant, ) -> Result<WebMessage, Error>
Asynchronously reads the next message from the channel. The client should invoke the callback when it is ready to process another message. Unreceived messages are buffered on the sender’s side and bounded by its available resources.
Trait Implementations§
Source§impl Debug for MessagePortSynchronousProxy
impl Debug for MessagePortSynchronousProxy
Source§impl SynchronousProxy for MessagePortSynchronousProxy
impl SynchronousProxy for MessagePortSynchronousProxy
Source§type Proxy = MessagePortProxy
type Proxy = MessagePortProxy
The async proxy for the same protocol.
Source§type Protocol = MessagePortMarker
type Protocol = MessagePortMarker
The protocol which this
Proxy
controls.Source§fn from_channel(inner: Channel) -> Self
fn from_channel(inner: Channel) -> Self
Create a proxy over the given channel.
Source§fn into_channel(self) -> Channel
fn into_channel(self) -> Channel
Convert the proxy back into a channel.
Source§fn as_channel(&self) -> &Channel
fn as_channel(&self) -> &Channel
Get a reference to the proxy’s underlying channel. Read more
Auto Trait Implementations§
impl Freeze for MessagePortSynchronousProxy
impl RefUnwindSafe for MessagePortSynchronousProxy
impl Send for MessagePortSynchronousProxy
impl Sync for MessagePortSynchronousProxy
impl Unpin for MessagePortSynchronousProxy
impl UnwindSafe for MessagePortSynchronousProxy
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