Message passing

Type ChanOne

type ChanOne<T> = oneshot::client::Oneshot<T>

The send end of a oneshot pipe.

Type PortOne

type PortOne<T> = oneshot::server::Oneshot<T>

The receive end of a oneshot pipe.

Type SharedChan

type SharedChan<T> = unstable::Exclusive<Chan<T>>

A channel that can be shared between many senders.

Enum Chan

An endpoint that can send many messages.

Variants

Enum Port

An endpoint that can receive many messages.

Variants

Struct PortSet

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

Treat many ports as one.

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(&self) -> Either<Option<T>, Option<U>>

Receive a message or return None if a connection closes.

Method select

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

Receive a message or fail if a connection closes.

Implementation for Chan<T> where <T: Owned>

Method send

fn send(&self, x: T)

Method try_send

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

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

Method send

fn send(&self, x: T)

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

Method try_send

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

Implementation for Port<T> where <T: Owned>

Method recv

fn recv(&self) -> T

Method try_recv

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

Method peek

fn peek(&self) -> bool

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

Method recv

fn recv(&self) -> T

Method try_recv

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

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

Method peek

fn peek(&self) -> bool

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

Method header

fn header(&self) -> *PacketHeader

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

Method recv

fn recv(&self) -> T

Method try_recv

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

Method peek

fn peek(&self) -> bool

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

Method add

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

Method chan

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

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

Method try_recv

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

Method recv

fn recv(&self) -> T

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

Method peek

fn peek(&self) -> bool

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

Method send

fn send(&self, x: T)

Method try_send

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

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

Method send

fn send(&self, x: T)

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

Method try_send

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

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

Method select

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

Method try_select

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

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

Method recv

fn recv(self) -> T

Method try_recv

fn try_recv(self) -> Option<T>

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

Method send

fn send(self, data: T)

Method try_send

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

Function PortSet

fn PortSet<T: Owned>() -> PortSet<T>

Function SharedChan

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

Converts a chan into a shared_chan.

Function oneshot

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

Initialiase a (send-endpoint, recv-endpoint) oneshot pipe pair.

Function recv_one

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

Receive a message from a oneshot pipe, failing if the connection was closed.

Function select2i

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

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

Function selecti

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

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

Function send_one

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

Send a message on a oneshot pipe, failing if the connection was closed.

Function stream

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

Creates a (chan, port) pair.

These allow sending or receiving an unlimited number of messages.

Function try_recv_one

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

Receive a message from a oneshot pipe unless the connection was closed.

Function try_send_one

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

Send a message on a oneshot pipe, or return false if the connection was closed.