Skip to main content

SyncChan

Struct SyncChan 

Source
pub struct SyncChan { /* private fields */ }
Expand description

A symmetric bounded channel over IpcMessage, used by the global channel registry for silo-to-silo syscall-level IPC.

Unlike Sender/Receiver, SyncChan has no directional specialisation: any caller with an Arc<SyncChan> can both send and receive. Destruction is explicit (via SyncChan::destroy), triggered when the last userspace handle is closed.

Implementations§

Source§

impl SyncChan

Source

pub fn send(&self, msg: IpcMessage) -> Result<(), ChannelError>

Send a message, blocking until space is available.

Returns Err(ChannelError::Disconnected) if the channel has been destroyed while the sender was blocked.

Source

pub fn try_send(&self, msg: IpcMessage) -> Result<(), ChannelError>

Try to send without blocking.

Returns Err(WouldBlock) if the queue is full, or Err(Disconnected) if the channel is destroyed.

Source

pub fn recv(&self) -> Result<IpcMessage, ChannelError>

Receive a message, blocking until one arrives.

Returns Err(ChannelError::Disconnected) if the channel was destroyed while the receiver was blocked.

Source

pub fn try_recv(&self) -> Result<IpcMessage, ChannelError>

Try to receive without blocking.

Returns Err(WouldBlock) if the queue is empty, or Err(Disconnected) if the channel is destroyed and empty.

Source

pub fn destroy(&self)

Mark the channel as destroyed and wake all blocked tasks.

Called when the last userspace handle is closed. Subsequent send/recv operations on any still-held reference return Disconnected.

Source

pub fn is_destroyed(&self) -> bool

Returns true if the channel has been destroyed.

Source

pub fn len(&self) -> usize

Returns the current number of messages buffered.

Source

pub fn is_empty(&self) -> bool

Returns true if the queue is empty.

Source

pub fn is_full(&self) -> bool

Returns whether full.

Source

pub fn can_send(&self) -> bool

Returns whether this can send.

Auto Trait Implementations§

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.