[][src]Struct rusty_junctions::Junction

pub struct Junction { /* fields omitted */ }

Struct managing the creation of new channels and Join Patterns.

This struct is used to group channels, such as SendChannel, which can be used in conjunction to create new Join Patterns. As such, it offers methods to create new channels which are then directly linked to this Junction. It also offers methods to start off the creation of new Join Patterns that rely on the channels created by this struct and can, in fact, only consist of channels associated with this struct.

Methods

impl Junction[src]

pub fn new() -> Junction[src]

Create a new Junction and start control thread in background.

Create a new Junction and spawn a control thread in the background that will handle all incoming Packets for this Junction. A JoinHandle to this control thread is stored alongside the Junction.

pub fn controller_handle(&mut self) -> Option<ControllerHandle>[src]

Return handle to internal Controller if available.

Each Junction has an associated control thread with a Controller running to handle incoming Packets. This Controller is gracefully stopped and its thread joined as soon as the Junction goes out of scope. However, as this is sometimes undesired behavior, the user can retrieve the handle to the Junction's Controller and its thread with this function and stop the Controller at a time of their choosing. Once this function has executed, the Junction will no long automatically stop its Controller and join the control thread upon going out of scope.

Note that this handle can only be retrieved once.

pub fn send_channel<T>(&self) -> SendChannel<T> where
    T: Any + Send
[src]

Create and return a new SendChannel on this Junction.

The generic parameter T is used to determine the type of values that can be sent on this channel.

Panics

Panics if it received an error while trying to receive a new channel ID from the control thread.

pub fn recv_channel<R>(&self) -> RecvChannel<R> where
    R: Any + Send
[src]

Create and return a new RecvChannel on this Junction.

The generic parameter R is used to determine the type of values that can be received on this channel.

Panics

Panics if it received an error while trying to receive a new channel ID from the control thread.

pub fn bidir_channel<T, R>(&self) -> BidirChannel<T, R> where
    T: Any + Send,
    R: Any + Send
[src]

Create and return a new BidirChannel on this Junction.

The generic parameter T is used to determine the type of values that can be sent on this channel while R is used to determine the type of values that can be received on this channel.

Panics

Panics if it received an error while trying to receive the new channel IDs from the control thread.

pub fn when<T>(&self, send_channel: &SendChannel<T>) -> SendPartialPattern<T> where
    T: Any + Send
[src]

Create new partial Join Pattern starting with a SendChannel.

Panics

Panics if the supplied SendChannel does not carry the same JunctionID as this Junction, i.e. has not been created by and is associated with this Junction.

pub fn when_recv<R>(
    &self,
    recv_channel: &RecvChannel<R>
) -> RecvPartialPattern<R> where
    R: Any + Send
[src]

Create new partial Join Pattern starting with a RecvChannel.

Panics

Panics if the supplied RecvChannel does not carry the same JunctionID as this Junction, i.e. has not been created by and is associated with this Junction.

pub fn when_bidir<T, R>(
    &self,
    bidir_channel: &BidirChannel<T, R>
) -> BidirPartialPattern<T, R> where
    T: Any + Send,
    R: Any + Send
[src]

Create a new partial Join Pattern starting with a BidirChannel.

Panics

Panics if the supplied BidirChannel does not carry the same JunctionID as this Junction, i.e. has not been created by and is associated with this Junction.

Trait Implementations

impl Drop for Junction[src]

fn drop(&mut self)[src]

Drop the Junction and free its resources.

If there is a ControllerHandle still available, use it to stop the associated Controller and join the control thread. Otherwise, no action is needed.

Auto Trait Implementations

impl !RefUnwindSafe for Junction

impl Send for Junction

impl !Sync for Junction

impl Unpin for Junction

impl !UnwindSafe for Junction

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.