Struct script_traits::transferable::MessagePortImpl
source · pub struct MessagePortImpl {
state: MessagePortState,
entangled_port: Option<MessagePortId>,
message_buffer: Option<VecDeque<PortMessageTask>>,
message_port_id: MessagePortId,
}
Expand description
The data and logic backing the DOM managed MessagePort.
Fields§
§state: MessagePortState
The current state of the port.
entangled_port: Option<MessagePortId>
§message_buffer: Option<VecDeque<PortMessageTask>>
§message_port_id: MessagePortId
The UUID of this port.
Implementations§
source§impl MessagePortImpl
impl MessagePortImpl
sourcepub fn new(port_id: MessagePortId) -> MessagePortImpl
pub fn new(port_id: MessagePortId) -> MessagePortImpl
Create a new messageport impl.
sourcepub fn message_port_id(&self) -> &MessagePortId
pub fn message_port_id(&self) -> &MessagePortId
Get the Id.
sourcepub fn entangled_port_id(&self) -> Option<MessagePortId>
pub fn entangled_port_id(&self) -> Option<MessagePortId>
Maybe get the Id of the entangled port.
sourcepub fn entangle(&mut self, other_id: MessagePortId)
pub fn entangle(&mut self, other_id: MessagePortId)
Entanged this port with another.
sourcepub fn set_has_been_shipped(&mut self)
pub fn set_has_been_shipped(&mut self)
Mark this port as having been shipped. https://html.spec.whatwg.org/multipage/#has-been-shipped
sourcepub fn complete_transfer(&mut self, tasks: VecDeque<PortMessageTask>)
pub fn complete_transfer(&mut self, tasks: VecDeque<PortMessageTask>)
Handle the completion of the transfer, this is data received from the constellation.
sourcepub fn handle_incoming(
&mut self,
task: PortMessageTask,
) -> Option<PortMessageTask>
pub fn handle_incoming( &mut self, task: PortMessageTask, ) -> Option<PortMessageTask>
A message was received from our entangled port, returns an optional task to be dispatched.
sourcepub fn start(&mut self) -> Option<VecDeque<PortMessageTask>>
pub fn start(&mut self) -> Option<VecDeque<PortMessageTask>>
https://html.spec.whatwg.org/multipage/#dom-messageport-start returns an optional queue of tasks that were buffered while the port was disabled.
Trait Implementations§
source§impl Debug for MessagePortImpl
impl Debug for MessagePortImpl
source§impl<'de> Deserialize<'de> for MessagePortImpl
impl<'de> Deserialize<'de> for MessagePortImpl
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl MallocSizeOf for MessagePortImpl
impl MallocSizeOf for MessagePortImpl
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl Freeze for MessagePortImpl
impl !RefUnwindSafe for MessagePortImpl
impl Send for MessagePortImpl
impl !Sync for MessagePortImpl
impl Unpin for MessagePortImpl
impl UnwindSafe for MessagePortImpl
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert