[][src]Struct splinter::mesh::Mesh

pub struct Mesh { /* fields omitted */ }

A Connection reactor

Methods

impl Mesh[src]

pub fn new(incoming_capacity: usize, outgoing_capacity: usize) -> Self[src]

Create a new mesh, spawning a background thread for sending and receiving, and setting up channels to communicate with it.

pub fn add(&self, connection: Box<dyn Connection>) -> Result<usize, AddError>[src]

Add a new connection to the mesh, moving it to the background thread, and return its id.

pub fn remove(&self, id: usize) -> Result<Box<dyn Connection>, RemoveError>[src]

Remove an existing connection from the mesh and return it.

pub fn send(&self, envelope: Envelope) -> Result<(), SendError>[src]

Send the envelope on the mesh.

This is a convenience function and is equivalent to mesh.outgoing(envelope.id()).send(envelope.take_payload()).

pub fn recv(&self) -> Result<Envelope, RecvError>[src]

Receive a new envelope from the mesh.

pub fn recv_timeout(
    &self,
    timeout: Duration
) -> Result<Envelope, RecvTimeoutError>
[src]

Receive a new envelope from the mesh.

pub fn outgoing(&self, id: usize) -> Option<Outgoing>[src]

Create a new handle for sending to the existing connection with the given id.

This may be faster if many sends on the same Connection are going to be performed because the internal lock around the pool of senders does not need to be reacquired.

pub fn incoming(&self) -> Incoming[src]

Create a new handle for receiving envelopes from the mesh.

This is useful if an object only needs to receive and doesn't need to send.

pub fn get_life_cycle(&self) -> MeshLifeCycle[src]

pub fn get_sender(&self) -> MeshMatrixSender[src]

Trait Implementations

impl Clone for Mesh[src]

Auto Trait Implementations

impl !RefUnwindSafe for Mesh

impl Send for Mesh

impl !Sync for Mesh

impl Unpin for Mesh

impl !UnwindSafe for Mesh

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<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Clone + Send + Sync

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

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

impl<T> IntoSql for T

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone

impl<T> SafeBorrow<T> for T where
    T: ?Sized

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,