Skip to main content

Port

Struct Port 

Source
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: PortId

Unique port identifier.

§owner: TaskId

TaskId of the port’s creator/owner.

Implementations§

Source§

impl Port

Source

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.

Source

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.

Source

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.

Source

pub fn has_messages(&self) -> bool

Returns whether messages is available.

Source

pub fn can_send(&self) -> bool

Returns whether this can send.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.