[][src]Struct spirit_tokio::handlers::PerConnection

pub struct PerConnection<F>(pub F);

A Transformation that creates a new future from each accepted connection.

For each connection yielded from the acceptor (passed in as the input resource), the function is used to create a new future. That new future is spawned into tokio runtime. Note that even when this resource gets uninstalled, the spawned futures from the connections are left running.

In case the acceptor yields an error, it is dropped and not used any more. Note that some primitives, like TcpListenWithLimits handles errors internally and never returns any, therefore it might be a good candidate for long-running servers.

Examples

Trait Implementations

impl<F, Fut, A, II, SF> Transformation<A, II, SF> for PerConnection<F> where
    A: Accept,
    F: Clone + FnMut(A::Connection, &SF) -> Fut + 'static,
    Fut: Future<Output = ()> + 'static,
    SF: Clone + 'static, 
[src]

type OutputResource = Acceptor<A, F, SF>

The type of resource after the transformation.

type OutputInstaller = FutureInstaller

The type of installer after the transformation. Read more

Auto Trait Implementations

impl<F> RefUnwindSafe for PerConnection<F> where
    F: RefUnwindSafe

impl<F> Send for PerConnection<F> where
    F: Send

impl<F> Sync for PerConnection<F> where
    F: Sync

impl<F> Unpin for PerConnection<F> where
    F: Unpin

impl<F> UnwindSafe for PerConnection<F> where
    F: UnwindSafe

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<T> From<T> for T[src]

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

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

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.