Struct Manager

Source
pub struct Manager<T> { /* private fields */ }
Expand description

Manager of a channel.

A channel manager can be used to create Senders and Receivers for a channel, without having access to either. Its made for the following use case: restarting an actor which takes ownership of the Receiver and crashes, and to restart the actor we need another Receiver. Using the manager a new Receiver can be created, ensuring only a single Receiver is alive at any given time.

Implementations§

Source§

impl<T> Manager<T>

Source

pub fn new_small_channel() -> (Manager<T>, Sender<T>, Receiver<T>)

Create a small bounded channel with a Manager.

Same as new_small but with a Manager.

Source

pub fn new_channel(capacity: usize) -> (Manager<T>, Sender<T>, Receiver<T>)

Create a bounded channel with a Manager.

Same as new but with a Manager.

Source

pub fn new_sender(&self) -> Sender<T>

Create a new Sender.

§Safety

See the safety nodes on Sender’s Clone implemenation, the same conditions apply here.

Source

pub fn new_receiver(&self) -> Result<Receiver<T>, ReceiverConnected>

Attempt to create a new Receiver.

This will fail if there already is a receiver.

Trait Implementations§

Source§

impl<T> Debug for Manager<T>

Source§

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

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

impl<T> Drop for Manager<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Send> Send for Manager<T>

Source§

impl<T> Sync for Manager<T>

Source§

impl<T> Unpin for Manager<T>

Auto Trait Implementations§

§

impl<T> Freeze for Manager<T>

§

impl<T> !RefUnwindSafe for Manager<T>

§

impl<T> !UnwindSafe for Manager<T>

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.