Trait nemo::IO [] [src]

pub unsafe trait IO {
    unsafe fn close(&mut self);
    unsafe fn send_discriminant(&mut self, _: usize);
    unsafe fn recv_discriminant(&mut self) -> Option<usize>;
}

This trait is implemented by backing IO structures to offer an interface for bi-directional channels. Discriminants are sent and received by Channel to indicate protocol changes; they tend to be smaller numbers, and so a variable length integer could be sent over a network instead of the raw usize.

As with all implementations of Transfer<T> for this concrete IO, if IO can guarantee that the backing channel is not accessed outside of these two traits, Channel can guarantee that these methods are only called when the data is expected over the channel. Over a network this expectation may not meet reality as there is no guarantee that the other side of the channel is implemented correctly. In that case, deserialization may be necessary.

Required Methods

Closes the channel.

Send a discriminant over the channel. Over a network a variable length integer would be ideal.

Receives a discriminant from the channel. Over a network a variable length integer would be ideal.

Implementors