Struct salt::Context
[−]
[src]
pub struct Context { /* fields omitted */ }
Context
represents the context of the current HTTP request.
A Context
consists of:
- A Handle
referencing the event loop in which this request is being
handled.
- The current HTTP Request
.
Methods
impl Context
[src]
fn handle(&self) -> &Handle
Return a reference to a handle to the event loop this Context
is associated with.
fn version(&self) -> &HttpVersion
Returns a reference to the request HTTP version.
fn headers(&self) -> &Headers
Returns a reference to the request headers.
fn method(&self) -> &Method
Returns a reference to the request HTTP method.
fn uri(&self) -> &Uri
Returns a reference to the request URI.
fn path(&self) -> &str
Returns a reference to the request path.
fn body(&self) -> &Body
Returns a reference to the request body.
Methods from Deref<Target = Handle>
fn remote(&self) -> &Remote
Returns a reference to the underlying remote handle to the event loop.
fn spawn<F>(&self, f: F) where
F: Future<Item = (), Error = ()> + 'static,
F: Future<Item = (), Error = ()> + 'static,
Spawns a new future on the event loop this handle is associated with.
fn spawn_fn<F, R>(&self, f: F) where
F: FnOnce() -> R + 'static,
R: IntoFuture<Item = (), Error = ()> + 'static,
F: FnOnce() -> R + 'static,
R: IntoFuture<Item = (), Error = ()> + 'static,
Spawns a closure on this event loop.
This function is a convenience wrapper around the spawn
function above
for running a closure wrapped in futures::lazy
. It will spawn the
function f
provided onto the event loop, and continue to run the
future returned by f
on the event loop as well.
fn id(&self) -> CoreId
Return the ID of the represented Core
Trait Implementations
impl Deref for Context
[src]
type Target = Handle
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value
impl Read for Context
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
unsafe fn initializer(&self) -> Initializer
read_initializer
)Determines if this Read
er can work with buffers of uninitialized memory. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0
Read all bytes until EOF in this source, placing them into buf
. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0
Read all bytes until EOF in this source, placing them into buf
. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0
Read the exact number of bytes required to fill buf
. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Read
. Read more
fn bytes(self) -> Bytes<Self>
1.0.0
Transforms this Read
instance to an Iterator
over its bytes. Read more
fn chars(self) -> Chars<Self>
🔬 This is a nightly-only experimental API. (io
)
the semantics of a partial read/write of where errors happen is currently unclear and may change
Transforms this Read
instance to an Iterator
over char
s. Read more
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0
R: Read,
Creates an adaptor which will chain this stream with another. Read more
fn take(self, limit: u64) -> Take<Self>
1.0.0
Creates an adaptor which will read at most limit
bytes from it. Read more
impl AsyncRead for Context
[src]
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool
Prepares an uninitialized buffer to be safe to pass to read
. Returns true
if the supplied buffer was zeroed out. Read more
fn read_buf<B>(&mut self, buf: &mut B) -> Result<Async<usize>, Error> where
B: BufMut,
B: BufMut,
Pull some bytes from this source into the specified Buf
, returning how many bytes were read. Read more
fn framed<T>(self, codec: T) -> Framed<Self, T> where
Self: AsyncWrite,
T: Decoder + Encoder,
Self: AsyncWrite,
T: Decoder + Encoder,
Provides a Stream
and Sink
interface for reading and writing to this Io
object, using Decode
and Encode
to read and write the raw data. Read more
fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>) where
Self: AsyncWrite,
Self: AsyncWrite,
Helper method for splitting this read/write object into two halves. Read more