[−][src]Struct rocket::http::hyper::Server
A server can listen on a TCP socket.
Once listening, it will create a Request
/Response
pair for each
incoming connection, and hand them to the provided handler.
Methods
impl<L> Server<L> where
L: NetworkListener,
[src]
L: NetworkListener,
pub fn new(listener: L) -> Server<L>
[src]
Creates a new server with the provided handler.
pub fn keep_alive(&mut self, timeout: Option<Duration>)
[src]
Controls keep-alive for this server.
The timeout duration passed will be used to determine how long to keep the connection alive before dropping it.
Passing None
will disable keep-alive.
Default is enabled with a 5 second timeout.
pub fn set_read_timeout(&mut self, dur: Option<Duration>)
[src]
Sets the read timeout for all Request reads.
pub fn set_write_timeout(&mut self, dur: Option<Duration>)
[src]
Sets the write timeout for all Response writes.
pub fn local_addr(&mut self) -> Result<SocketAddr, Error>
[src]
Get the address that the server is listening on.
impl Server<HttpListener>
[src]
pub fn http<To>(addr: To) -> Result<Server<HttpListener>, Error> where
To: ToSocketAddrs,
[src]
To: ToSocketAddrs,
Creates a new server that will handle HttpStream
s.
impl<S> Server<HttpsListener<S>> where
S: SslServer<HttpStream> + Clone + Send,
[src]
S: SslServer<HttpStream> + Clone + Send,
pub fn https<A>(addr: A, ssl: S) -> Result<Server<HttpsListener<S>>, Error> where
A: ToSocketAddrs,
[src]
A: ToSocketAddrs,
Creates a new server that will handle HttpStream
s over SSL.
You can use any SSL implementation, as long as implements hyper::net::Ssl
.
impl<L> Server<L> where
L: 'static + NetworkListener + Send,
[src]
L: 'static + NetworkListener + Send,
pub fn handle<H>(self, handler: H) -> Result<Listening, Error> where
H: 'static + Handler,
[src]
H: 'static + Handler,
Binds to a socket and starts handling connections.
pub fn handle_threads<H>(
self,
handler: H,
threads: usize
) -> Result<Listening, Error> where
H: 'static + Handler,
[src]
self,
handler: H,
threads: usize
) -> Result<Listening, Error> where
H: 'static + Handler,
Binds to a socket and starts handling connections with the provided number of threads.
Trait Implementations
Auto Trait Implementations
impl<L> RefUnwindSafe for Server<L> where
L: RefUnwindSafe,
L: RefUnwindSafe,
impl<L> Send for Server<L> where
L: Send,
L: Send,
impl<L> Sync for Server<L> where
L: Sync,
L: Sync,
impl<L> Unpin for Server<L> where
L: Unpin,
L: Unpin,
impl<L> UnwindSafe for Server<L> where
L: UnwindSafe,
L: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
[src]
I: Input,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> for T
[src]
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
[src]
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
[src]
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
[src]
T: Any,