[][src]Struct izanami::server::Server

pub struct Server<T = DefaultTransport<TcpListener>, B = Threadpool> { /* fields omitted */ }

A simple HTTP server that wraps the hyper's server implementation.

Methods

impl Server
[src]

pub fn bind_tcp(
    addr: &SocketAddr
) -> Result<Server<DefaultTransport<TcpListener>>>
[src]

Creates an HTTP server using a TCP listener.

pub fn bind_uds(
    path: impl AsRef<Path>
) -> Result<Server<DefaultTransport<UnixListener>>>
[src]

Creates an HTTP server using a Unix domain socket listener.

impl<T, B> Server<T, B> where
    T: Transport
[src]

pub fn new(transport: T) -> Self
[src]

Create a Server from a specific Transport.

pub fn transport(&mut self) -> &mut T
[src]

Returns a reference to the inner transport.

pub fn protocol(&mut self) -> &mut Http
[src]

Returns a reference to the HTTP-level configuration.

pub fn current_thread(self) -> Server<T, CurrentThread>
[src]

Switches the backend to CurrentThread.

pub fn start<S>(self, make_service: S) -> Result<()> where
    S: MakeServiceRef<T::Conn, Request<RequestBody>>,
    B: Backend<T::Incoming, S>, 
[src]

Starts an HTTP server using the specific MakeService.

impl<T, A, R> Server<DefaultTransport<T, A>, R> where
    T: Transport,
    A: Acceptor<T::Conn>, 
[src]

pub fn acceptor<A2>(self, acceptor: A2) -> Server<DefaultTransport<T, A2>, R> where
    A2: Acceptor<T::Conn>, 
[src]

Sets the instance of Acceptor to the server.

By default, the raw acceptor is set, which returns the incoming I/Os directly.

pub fn sleep_on_errors(self, duration: Option<Duration>) -> Self
[src]

Sets the time interval for sleeping on errors.

If this value is set, the incoming stream sleeps for the specific period instead of terminating, and then attemps to accept again after woken up.

The default value is Some(1sec).

Trait Implementations

impl<T, B> Debug for Server<T, B> where
    T: Transport + Debug
[src]

Auto Trait Implementations

impl<T, B> Send for Server<T, B> where
    B: Send,
    T: Send

impl<T, B> Sync for Server<T, B> where
    B: Sync,
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T