Struct actix_web::HttpServer
[−]
[src]
pub struct HttpServer<T, A, H> { /* fields omitted */ }
An HTTP Server
T
- async stream, anything that implements AsyncRead
+ AsyncWrite
.
A
- peer address
H
- request handler
Methods
impl<T, A, H> HttpServer<T, A, H> where
H: HttpHandler,
[src]
H: HttpHandler,
fn new<U: IntoIterator<Item = H>>(handler: U) -> Self
[src]
Create new http server with vec of http handlers
impl<T, A, H> HttpServer<T, A, H> where
T: AsyncRead + AsyncWrite + 'static,
A: 'static,
H: HttpHandler,
[src]
T: AsyncRead + AsyncWrite + 'static,
A: 'static,
H: HttpHandler,
fn serve_incoming<S, Addr>(self, stream: S) -> Result<Addr> where
Self: ActorAddress<Self, Addr>,
S: Stream<Item = (T, A), Error = Error> + 'static,
[src]
Self: ActorAddress<Self, Addr>,
S: Stream<Item = (T, A), Error = Error> + 'static,
Start listening for incomming connections from stream.
impl<H: HttpHandler> HttpServer<TcpStream, SocketAddr, H>
[src]
fn serve<S, Addr>(self, addr: S) -> Result<Addr> where
Self: ActorAddress<Self, Addr>,
S: ToSocketAddrs,
[src]
Self: ActorAddress<Self, Addr>,
S: ToSocketAddrs,
Start listening for incomming connections.
This methods converts address to list of SocketAddr
then binds to all available addresses.
Trait Implementations
impl<T: 'static, A: 'static, H: 'static> Actor for HttpServer<T, A, H>
[src]
type Context = Context<Self>
Actor execution context type
fn started(&mut self, ctx: &mut Self::Context)
[src]
Method is called when actor get polled first time.
fn stopping(&mut self, ctx: &mut Self::Context)
[src]
Method is called after an actor is in Actor::Stopping
state. There could be several reasons for stopping. Context::stop
get called by the actor itself. All addresses to current actor get dropped and no more evented objects left in the context. Actor could restore from stopping state to running state by creating new address or adding future or stream to current content. Read more
fn stopped(&mut self, ctx: &mut Self::Context)
[src]
Method is called after an actor is stopped, it can be used to perform any needed cleanup work or spawning more actors. This is final state, after this call actor get dropped. Read more
fn start<Addr>(self) -> Addr where
Self: Actor<Context = Context<Self>> + ActorAddress<Self, Addr>,
[src]
Self: Actor<Context = Context<Self>> + ActorAddress<Self, Addr>,
Start new asynchronous actor, returns address of newly created actor. Read more
fn create<Addr, F>(f: F) -> Addr where
F: FnOnce(&mut Context<Self>) -> Self + 'static,
Self: Actor<Context = Context<Self>> + ActorAddress<Self, Addr>,
[src]
F: FnOnce(&mut Context<Self>) -> Self + 'static,
Self: Actor<Context = Context<Self>> + ActorAddress<Self, Addr>,
Use create
method, if you need Context
object during actor initialization. Read more
fn reply<M>(val: <M as ResponseType>::Item) -> Response<Self, M> where
M: ResponseType,
[src]
M: ResponseType,
Create static response.
fn async_reply<T, M>(fut: T) -> Response<Self, M> where
M: ResponseType,
T: ActorFuture<Item = <M as ResponseType>::Item, Error = <M as ResponseType>::Error, Actor = Self> + 'static,
[src]
M: ResponseType,
T: ActorFuture<Item = <M as ResponseType>::Item, Error = <M as ResponseType>::Error, Actor = Self> + 'static,
Create async response process.
fn empty<M>() -> Response<Self, M> where
M: ResponseType<Item = ()>,
[src]
M: ResponseType<Item = ()>,
Create unit response, for case when ResponseType::Item = ()
fn reply_error<M>(err: <M as ResponseType>::Error) -> Response<Self, M> where
M: ResponseType,
[src]
M: ResponseType,
Create error response
impl<T, A, H> StreamHandler<IoStream<T, A>, Error> for HttpServer<T, A, H> where
T: AsyncRead + AsyncWrite + 'static,
A: 'static,
H: HttpHandler + 'static,
[src]
T: AsyncRead + AsyncWrite + 'static,
A: 'static,
H: HttpHandler + 'static,
fn started(&mut self, ctx: &mut Self::Context)
[src]
Method is called when stream get polled first time.
fn finished(&mut self, ctx: &mut Self::Context)
[src]
Method is called when stream finishes, even if stream finishes with error.
impl<T, A, H> Handler<IoStream<T, A>, Error> for HttpServer<T, A, H> where
T: AsyncRead + AsyncWrite + 'static,
A: 'static,
H: HttpHandler + 'static,
[src]
T: AsyncRead + AsyncWrite + 'static,
A: 'static,
H: HttpHandler + 'static,