Message passing
Chan
- An endpoint that can send many messages.ChanOne
Port
- An endpoint that can receive many messages.PortOne
PortSet
- Treat many ports as one.SharedChan
- A channel that can be shared between many senders.GenericChan
- A trait for things that can send multiple messages.GenericPort
- A trait for things that can receive multiple messages.GenericSmartChan
- Things that can send multiple messages and can detect when the receiver is closedPeekable
- Ports that can peek
Select2
- Receive a message from one of two endpoints.of GenericChan<T> for Chan<T> where <T: Send>
of GenericSmartChan<T> for Chan<T> where <T: Send>
of GenericPort<T> for Port<T> where <T: Send>
of Peekable<T> for Port<T> where <T: Send>
of Selectable for Port<T> where <T: Send>
for PortSet<T> where <T: Send>
of GenericPort<T> for PortSet<T> where <T: Send>
of Peekable<T> for PortSet<T> where <T: Send>
for SharedChan<T> where <T: Send>
of GenericChan<T> for SharedChan<T> where <T: Send>
of GenericSmartChan<T> for SharedChan<T> where <T: Send>
of ::clone::Clone for SharedChan<T> where <T: Send>
for PortOne<T> where <T: Send>
for ChanOne<T> where <T: Send>
of Select2<T, U> for (Left, Right) where <T: Send, U: Send, Left: Selectable + GenericPort<T>, Right: Selectable + GenericPort<U>>
oneshot
recv_one
select2i
- Returns 0 or 1 depending on which endpoint is ready to receiveselecti
- Returns the index of an endpoint that is ready to receive.send_one
stream
- Creates a (Port, Chan)
pair.try_recv_one
try_send_one
Chan
pub struct Chan<T> {
inner: Either<pipesy::Chan<T>, rtcomm::Chan<T>>,
}
An endpoint that can send many messages.
ChanOne
pub struct ChanOne<T> {
inner: Either<pipesy::ChanOne<T>, rtcomm::ChanOne<T>>,
}
Port
pub struct Port<T> {
inner: Either<pipesy::Port<T>, rtcomm::Port<T>>,
}
An endpoint that can receive many messages.
PortOne
pub struct PortOne<T> {
inner: Either<pipesy::PortOne<T>, rtcomm::PortOne<T>>,
}
PortSet
pub struct PortSet<T> {
ports: ~[pipesy::Port<T>],
}
Treat many ports as one.
GenericChan
A trait for things that can send multiple messages.
send
fn send(&self, x: T)
Sends a message.
GenericPort
A trait for things that can receive multiple messages.
recv
fn recv(&self) -> T
Receives a message, or fails if the connection closes.
try_recv
fn try_recv(&self) -> Option<T>
Receives a message, or returns none
if the connection is closed or closes.
GenericSmartChan
Things that can send multiple messages and can detect when the receiver is closed
try_send
fn try_send(&self, x: T) -> bool
Sends a message, or report if the receiver has closed the connection.
Peekable
Ports that can peek
peek
fn peek(&self) -> bool
Returns true if a message is available
Select2
Receive a message from one of two endpoints.
try_select
fn try_select(&mut self) -> Either<Option<T>, Option<U>>
Receive a message or return None
if a connection closes.
select
fn select(&mut self) -> Either<T, U>
Receive a message or fail if a connection closes.
GenericChan<T>
for Chan<T>
where <T: Send>
send
fn send(&self, x: T)
GenericSmartChan<T>
for Chan<T>
where <T: Send>
try_send
fn try_send(&self, x: T) -> bool
GenericPort<T>
for Port<T>
where <T: Send>
recv
fn recv(&self) -> T
try_recv
fn try_recv(&self) -> Option<T>
Peekable<T>
for Port<T>
where <T: Send>
peek
fn peek(&self) -> bool
Selectable
for Port<T>
where <T: Send>
header
fn header(&mut self) -> *mut PacketHeader
PortSet<T>
where <T: Send>
new
fn new() -> PortSet<T>
add
fn add(&self, port: Port<T>)
chan
fn chan(&self) -> Chan<T>
GenericPort<T>
for PortSet<T>
where <T: Send>
try_recv
fn try_recv(&self) -> Option<T>
recv
fn recv(&self) -> T
Peekable<T>
for PortSet<T>
where <T: Send>
peek
fn peek(&self) -> bool
PortOne<T>
where <T: Send>
recv
fn recv(self) -> T
try_recv
fn try_recv(self) -> Option<T>
ChanOne<T>
where <T: Send>
send
fn send(self, data: T)
try_send
fn try_send(self, data: T) -> bool
Select2<T, U>
for (Left, Right)
where <T: Send, U: Send, Left: Selectable + GenericPort<T>, Right: Selectable + GenericPort<U>>
select
fn select(&mut self) -> Either<T, U>
try_select
fn try_select(&mut self) -> Either<Option<T>, Option<U>>
oneshot
fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>)
recv_one
fn recv_one<T: Send>(port: PortOne<T>) -> T
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
selecti
fn selecti<T: Selectable>(endpoints: &mut [T]) -> uint
Returns the index of an endpoint that is ready to receive.
send_one
fn send_one<T: Send>(chan: ChanOne<T>, data: T)
stream
fn stream<T: Send>() -> (Port<T>, Chan<T>)
Creates a (Port, Chan)
pair.
These allow sending or receiving an unlimited number of messages.
try_recv_one
fn try_recv_one<T: Send>(port: PortOne<T>) -> Option<T>
try_send_one
fn try_send_one<T: Send>(chan: ChanOne<T>, data: T) -> bool