[][src]Struct actix_web::HttpContext

pub struct HttpContext<A, S = ()> where
    A: Actor<Context = HttpContext<A, S>>, 
{ /* fields omitted */ }

Execution context for http actors

Methods

impl<A, S: 'static> HttpContext<A, S> where
    A: Actor<Context = Self>, 
[src]

pub fn create(req: HttpRequest<S>, actor: A) -> Body[src]

Create a new HTTP Context from a request and an actor

pub fn with_factory<F>(req: HttpRequest<S>, f: F) -> Body where
    F: FnOnce(&mut Self) -> A + 'static, 
[src]

Create a new HTTP Context

impl<A, S> HttpContext<A, S> where
    A: Actor<Context = Self>, 
[src]

pub fn state(&self) -> &S[src]

Shared application state

pub fn request(&mut self) -> &mut HttpRequest<S>[src]

Incoming request

pub fn write<B: Into<Binary>>(&mut self, data: B)[src]

Write payload

pub fn write_eof(&mut self)[src]

Indicate end of streaming payload. Also this method calls Self::close.

pub fn drain(&mut self) -> Drain<A>[src]

Returns drain future

pub fn connected(&self) -> bool[src]

Check if connection still open

pub fn handle(&self) -> SpawnHandle[src]

Handle of the running future

SpawnHandle is the handle returned by AsyncContext::spawn() method.

Trait Implementations

impl<A, S> ActorContext for HttpContext<A, S> where
    A: Actor<Context = Self>, 
[src]

impl<A, S> AsyncContext<A> for HttpContext<A, S> where
    A: Actor<Context = Self>, 
[src]

fn waiting(&self) -> bool[src]

Check if context is paused (waiting for future completion or stopping)

fn add_stream<S>(&mut self, fut: S) -> SpawnHandle where
    A: StreamHandler<<S as Stream>::Item, <S as Stream>::Error>,
    S: Stream + 'static, 
[src]

This method register stream to an actor context and allows to handle Stream in similar way as normal actor messages. Read more

fn add_message_stream<S>(&mut self, fut: S) where
    A: Handler<<S as Stream>::Item>,
    S: Stream<Error = ()> + 'static,
    <S as Stream>::Item: Message
[src]

This method is similar to add_stream but it skips stream errors. Read more

fn notify<M>(&mut self, msg: M) where
    A: Handler<M>,
    M: Message + 'static, 
[src]

Send message msg to self.

fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle where
    A: Handler<M>,
    M: Message + 'static, 
[src]

Send message msg to self after specified period of time. Returns spawn handle which could be used for cancellation. Notification get cancelled if context's stop method get called. Read more

fn run_later<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
    F: FnOnce(&mut A, &mut <A as Actor>::Context) + 'static, 
[src]

Execute closure after specified period of time within same Actor and Context. Execution get cancelled if context's stop method get called. Read more

fn run_interval<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
    F: FnMut(&mut A, &mut <A as Actor>::Context) + 'static, 
[src]

Spawns a job to execute the given closure periodically, at a specified fixed interval Read more

impl<A, M, S> ToEnvelope<A, M> for HttpContext<A, S> where
    A: Actor<Context = HttpContext<A, S>> + Handler<M>,
    M: Message + Send + 'static,
    M::Result: Send
[src]

impl<A, S> AsyncContextParts<A> for HttpContext<A, S> where
    A: Actor<Context = Self>, 
[src]

Auto Trait Implementations

impl<A, S = ()> !Send for HttpContext<A, S>

impl<A, S = ()> !Sync for HttpContext<A, S>

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?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

The type returned in the event of a conversion error.

impl<T> Erased for T