[−][src]Struct hyper::server::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: NetworkListener> Server<L>
[src]
impl<L: NetworkListener> Server<L>
pub fn new(listener: L) -> Server<L>
[src]
pub fn new(listener: L) -> Server<L>
Creates a new server with the provided handler.
pub fn keep_alive(&mut self, timeout: Option<Duration>)
[src]
pub fn keep_alive(&mut self, timeout: Option<Duration>)
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]
pub fn set_read_timeout(&mut self, dur: Option<Duration>)
Sets the read timeout for all Request reads.
pub fn set_write_timeout(&mut self, dur: Option<Duration>)
[src]
pub fn set_write_timeout(&mut self, dur: Option<Duration>)
Sets the write timeout for all Response writes.
pub fn local_addr(&mut self) -> Result<SocketAddr>
[src]
pub fn local_addr(&mut self) -> Result<SocketAddr>
Get the address that the server is listening on.
impl Server<HttpListener>
[src]
impl Server<HttpListener>
pub fn http<To: ToSocketAddrs>(addr: To) -> Result<Server<HttpListener>>
[src]
pub fn http<To: ToSocketAddrs>(addr: To) -> Result<Server<HttpListener>>
Creates a new server that will handle HttpStream
s.
impl<S: SslServer + Clone + Send> Server<HttpsListener<S>>
[src]
impl<S: SslServer + Clone + Send> Server<HttpsListener<S>>
pub fn https<A: ToSocketAddrs>(
addr: A,
ssl: S
) -> Result<Server<HttpsListener<S>>>
[src]
pub fn https<A: ToSocketAddrs>(
addr: A,
ssl: S
) -> Result<Server<HttpsListener<S>>>
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: NetworkListener + Send + 'static> Server<L>
[src]
impl<L: NetworkListener + Send + 'static> Server<L>
pub fn handle<H: Handler + 'static>(self, handler: H) -> Result<Listening>
[src]
pub fn handle<H: Handler + 'static>(self, handler: H) -> Result<Listening>
Binds to a socket and starts handling connections.
pub fn handle_threads<H: Handler + 'static>(
self,
handler: H,
threads: usize
) -> Result<Listening>
[src]
pub fn handle_threads<H: Handler + 'static>(
self,
handler: H,
threads: usize
) -> Result<Listening>
Binds to a socket and starts handling connections with the provided number of threads.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Typeable for T where
T: Any,
[src]
impl<T> Typeable for T where
T: Any,