ipc_channel::router

Struct ROUTER

source
pub struct ROUTER { /* private fields */ }
Expand description

Global object wrapping a RouterProxy. Add routes (add_route), or convert IpcReceiver to crossbeam channels (e.g. route_ipc_receiver_to_new_crossbeam_receiver)

Methods from Deref<Target = RouterProxy>§

source

pub fn add_route(&self, receiver: OpaqueIpcReceiver, callback: RouterHandler)

Add a new (receiver, callback) pair to the router, and send a wakeup message to the router.

source

pub fn shutdown(&self)

Send a shutdown message to the router containing a ACK sender, send a wakeup message to the router, and block on the ACK. Calling it is idempotent, which can be useful when running a multi-process system in single-process mode.

source

pub fn route_ipc_receiver_to_crossbeam_sender<T>( &self, ipc_receiver: IpcReceiver<T>, crossbeam_sender: Sender<T>, )
where T: for<'de> Deserialize<'de> + Serialize + Send + 'static,

A convenience function to route an IpcReceiver<T> to an existing Sender<T>.

source

pub fn route_ipc_receiver_to_new_crossbeam_receiver<T>( &self, ipc_receiver: IpcReceiver<T>, ) -> Receiver<T>
where T: for<'de> Deserialize<'de> + Serialize + Send + 'static,

A convenience function to route an IpcReceiver<T> to a Receiver<T>: the most common use of a Router.

Trait Implementations§

source§

impl Deref for ROUTER

source§

type Target = RouterProxy

The resulting type after dereferencing.
source§

fn deref(&self) -> &RouterProxy

Dereferences the value.
source§

impl LazyStatic for ROUTER

Auto Trait Implementations§

§

impl Freeze for ROUTER

§

impl RefUnwindSafe for ROUTER

§

impl Send for ROUTER

§

impl Sync for ROUTER

§

impl Unpin for ROUTER

§

impl UnwindSafe for ROUTER

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.