Message passing

Struct Chan

pub struct Chan<T> {
    inner: Either<pipesy::Chan<T>, rtcomm::Chan<T>>,
}

An endpoint that can send many messages.

Struct ChanOne

pub struct ChanOne<T> {
    inner: Either<pipesy::ChanOne<T>, rtcomm::ChanOne<T>>,
}

Struct Port

pub struct Port<T> {
    inner: Either<pipesy::Port<T>, rtcomm::Port<T>>,
}

An endpoint that can receive many messages.

Struct PortOne

pub struct PortOne<T> {
    inner: Either<pipesy::PortOne<T>, rtcomm::PortOne<T>>,
}

Struct PortSet

pub struct PortSet<T> {
    ports: ~[pipesy::Port<T>],
}

Treat many ports as one.

Struct SharedChan

pub struct SharedChan<T> {
    ch: Exclusive<pipesy::Chan<T>>,
}

A channel that can be shared between many senders.

Trait GenericChan

A trait for things that can send multiple messages.

Method send

fn send(&self, x: T)

Sends a message.

Trait GenericPort

A trait for things that can receive multiple messages.

Method recv

fn recv(&self) -> T

Receives a message, or fails if the connection closes.

Method try_recv

fn try_recv(&self) -> Option<T>

Receives a message, or returns none if the connection is closed or closes.

Trait GenericSmartChan

Things that can send multiple messages and can detect when the receiver is closed

Method try_send

fn try_send(&self, x: T) -> bool

Sends a message, or report if the receiver has closed the connection.

Trait Peekable

Ports that can peek

Method peek

fn peek(&self) -> bool

Returns true if a message is available

Trait Select2

Receive a message from one of two endpoints.

Method try_select

fn try_select(&mut self) -> Either<Option<T>, Option<U>>

Receive a message or return None if a connection closes.

Method select

fn select(&mut self) -> Either<T, U>

Receive a message or fail if a connection closes.

Implementation of GenericChan<T> for Chan<T> where <T: Send>

Method send

fn send(&self, x: T)

Implementation of GenericSmartChan<T> for Chan<T> where <T: Send>

Method try_send

fn try_send(&self, x: T) -> bool

Implementation of GenericPort<T> for Port<T> where <T: Send>

Method recv

fn recv(&self) -> T

Method try_recv

fn try_recv(&self) -> Option<T>

Implementation of Peekable<T> for Port<T> where <T: Send>

Method peek

fn peek(&self) -> bool

Implementation of Selectable for Port<T> where <T: Send>

Method header

fn header(&mut self) -> *mut PacketHeader

Implementation for PortSet<T> where <T: Send>

Method new

fn new() -> PortSet<T>

Method add

fn add(&self, port: Port<T>)

Method chan

fn chan(&self) -> Chan<T>

Implementation of GenericPort<T> for PortSet<T> where <T: Send>

Method try_recv

fn try_recv(&self) -> Option<T>

Method recv

fn recv(&self) -> T

Implementation of Peekable<T> for PortSet<T> where <T: Send>

Method peek

fn peek(&self) -> bool

Implementation for SharedChan<T> where <T: Send>

Method new

fn new(c: Chan<T>) -> SharedChan<T>

Converts a chan into a shared_chan.

Implementation of GenericChan<T> for SharedChan<T> where <T: Send>

Method send

fn send(&self, x: T)

Implementation of GenericSmartChan<T> for SharedChan<T> where <T: Send>

Method try_send

fn try_send(&self, x: T) -> bool

Implementation of ::clone::Clone for SharedChan<T> where <T: Send>

Method clone

fn clone(&self) -> SharedChan<T>

Implementation for PortOne<T> where <T: Send>

Method recv

fn recv(self) -> T

Method try_recv

fn try_recv(self) -> Option<T>

Implementation for ChanOne<T> where <T: Send>

Method send

fn send(self, data: T)

Method try_send

fn try_send(self, data: T) -> bool

Implementation of Select2<T, U> for (Left, Right) where <T: Send, U: Send, Left: Selectable + GenericPort<T>, Right: Selectable + GenericPort<U>>

Method select

fn select(&mut self) -> Either<T, U>

Method try_select

fn try_select(&mut self) -> Either<Option<T>, Option<U>>

Function oneshot

fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>)

Function recv_one

fn recv_one<T: Send>(port: PortOne<T>) -> T

Function select2i

fn select2i<A: Selectable, B: Selectable>(a: &mut A, b: &mut B) ->
 Either<(), ()>

Returns 0 or 1 depending on which endpoint is ready to receive

Function selecti

fn selecti<T: Selectable>(endpoints: &mut [T]) -> uint

Returns the index of an endpoint that is ready to receive.

Function send_one

fn send_one<T: Send>(chan: ChanOne<T>, data: T)

Function stream

fn stream<T: Send>() -> (Port<T>, Chan<T>)

Creates a (Port, Chan) pair.

These allow sending or receiving an unlimited number of messages.

Function try_recv_one

fn try_recv_one<T: Send>(port: PortOne<T>) -> Option<T>

Function try_send_one

fn try_send_one<T: Send>(chan: ChanOne<T>, data: T) -> bool