pub struct Port {
pub id: PortId,
pub owner: TaskId,
/* private fields */
}Expand description
An IPC port: a bounded message queue with blocking semantics.
Fields§
§id: PortIdUnique port identifier.
owner: TaskIdTaskId of the port’s creator/owner.
Implementations§
Source§impl Port
impl Port
Sourcepub fn send(&self, msg: IpcMessage) -> Result<(), IpcError>
pub fn send(&self, msg: IpcMessage) -> Result<(), IpcError>
Send a message to this port.
If the queue is full, the calling task blocks until space is available.
Returns Err(IpcError::PortDestroyed) if the port is destroyed while
the sender is blocked.
Sourcepub fn recv(&self) -> Result<IpcMessage, IpcError>
pub fn recv(&self) -> Result<IpcMessage, IpcError>
Receive a message from this port.
If the queue is empty, the calling task blocks until a message arrives.
Returns Err(IpcError::PortDestroyed) if the port is destroyed while
the receiver is blocked.
Sourcepub fn try_recv(&self) -> Result<Option<IpcMessage>, IpcError>
pub fn try_recv(&self) -> Result<Option<IpcMessage>, IpcError>
Try to receive a message from this port without blocking.
Returns Ok(Some(msg)) if a message was available, Ok(None) if empty,
or Err(IpcError::PortDestroyed) if the port is destroyed.
Sourcepub fn has_messages(&self) -> bool
pub fn has_messages(&self) -> bool
Returns whether messages is available.
Sourcepub fn is_destroyed(&self) -> bool
pub fn is_destroyed(&self) -> bool
Returns whether destroyed.
Auto Trait Implementations§
impl !Freeze for Port
impl !RefUnwindSafe for Port
impl Send for Port
impl Sync for Port
impl Unpin for Port
impl UnsafeUnpin for Port
impl UnwindSafe for Port
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
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>
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>
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 more