Channel

Struct Channel 

Source
pub struct Channel<M> { /* private fields */ }
Expand description

Contains all data that should be shared between Addresses, Inboxes and the Child.

Implementations§

Source§

impl<M> Channel<M>

Source

pub fn try_recv(&self, signaled_halt: &mut bool) -> Result<M, TryRecvError>

This will attempt to receive a message from the Inbox. If there is no message, this will return None.

Source

pub fn recv<'a>( &'a self, signaled_halt: &'a mut bool, listener: &'a mut Option<EventListener>, ) -> RecvFut<'a, M>

Wait until there is a message in the Inbox.

Source§

impl<M> Channel<M>

Source

pub fn send(&self, msg: M) -> SendFut<'_, M>

Source

pub fn send_now(&self, msg: M) -> Result<(), TrySendError<M>>

Source

pub fn try_send(&self, msg: M) -> Result<(), TrySendError<M>>

Source

pub fn send_blocking(&self, msg: M) -> Result<(), SendError<M>>

Trait Implementations§

Source§

impl<M: Send + 'static> AnyChannel for Channel<M>

Source§

fn into_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync>

Source§

impl<M> Debug for Channel<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M> DynChannel for Channel<M>

Source§

fn close(&self) -> bool

Close the channel. Returns true if the channel was not closed before this. Otherwise, this returns false.

§Notifies
  • if true -> all send_listeners & recv_listeners
Source§

fn halt_some(&self, n: u32)

Halt n inboxes associated with this channel. If n >= #inboxes, all inboxes will be halted. This might leave halt-count > inbox-count, however that’s not a problem. If n > i32::MAX, n = i32::MAX.

§Notifies
  • all recv-listeners
Source§

fn process_count(&self) -> usize

Returns the amount of inboxes this channel has.

Source§

fn msg_count(&self) -> usize

Returns the amount of messages currently in the channel.

Source§

fn address_count(&self) -> usize

Returns the amount of addresses this channel has.

Source§

fn is_closed(&self) -> bool

Whether the queue asscociated to the channel has been closed.

Source§

fn capacity(&self) -> &Capacity

Capacity of the inbox.

Source§

fn has_exited(&self) -> bool

Whether all inboxes linked to this channel have exited.

Source§

fn add_address(&self) -> usize

Add an Address to the channel, incrementing address-count by 1. Afterwards, a new Address may be created from this channel.

Returns the previous inbox-count

Source§

fn remove_address(&self) -> usize

Remove an Address from the channel, decrementing address-count by 1. This should be called from the destructor of the Address.

§Notifies
  • prev-address-count == 1 -> all send_listeners & recv_listeners
§Panics
  • prev-address-count == 0
Source§

fn actor_id(&self) -> u64

Get the actor_id.

Source§

fn is_bounded(&self) -> bool

Whether the channel is bounded.

Source§

fn get_exit_listener(&self) -> EventListener

Source§

fn halt(&self)

Auto Trait Implementations§

§

impl<M> !Freeze for Channel<M>

§

impl<M> RefUnwindSafe for Channel<M>

§

impl<M> Send for Channel<M>
where M: Send,

§

impl<M> Sync for Channel<M>
where M: Send,

§

impl<M> Unpin for Channel<M>
where M: Unpin,

§

impl<M> UnwindSafe for Channel<M>

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, 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.