Struct trillium_http::Upgrade
source · pub struct Upgrade<Transport> {
pub request_headers: Headers,
pub path: String,
pub method: Method,
pub state: StateSet,
pub transport: Transport,
pub buffer: Option<Vec<u8>>,
pub stopper: Stopper,
}
Expand description
This open (pub fields) struct represents a http upgrade. It contains all of the data available on a Conn, as well as owning the underlying transport.
Important implementation note: When reading directly from the
transport, ensure that you read from buffer
first if there are bytes
in it. Alternatively, read directly from the Upgrade, as that
[AsyncRead
] implementation will drain the buffer first before
reading from the transport.
Fields§
§request_headers: Headers
The http request headers
path: String
The request path
method: Method
The http request method
state: StateSet
Any state that has been accumulated on the Conn before negotiating the upgrade
transport: Transport
The underlying io (often a TcpStream or similar)
buffer: Option<Vec<u8>>
Any bytes that have been read from the underlying tcpstream already. It is your responsibility to process these bytes before reading directly from the transport.
stopper: Stopper
A Stopper
which can and should be used to gracefully shut
down any long running streams or futures associated with this
upgrade
Implementations§
Trait Implementations§
source§impl<Transport: AsyncRead + Unpin> AsyncRead for Upgrade<Transport>
impl<Transport: AsyncRead + Unpin> AsyncRead for Upgrade<Transport>
source§impl<Transport> AsyncWrite for Upgrade<Transport>
impl<Transport> AsyncWrite for Upgrade<Transport>
source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8] ) -> Poll<Result<usize>>
buf
into the object. Read moresource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Auto Trait Implementations§
impl<Transport> !RefUnwindSafe for Upgrade<Transport>
impl<Transport> Send for Upgrade<Transport>where
Transport: Send,
impl<Transport> Sync for Upgrade<Transport>where
Transport: Sync,
impl<Transport> Unpin for Upgrade<Transport>where
Transport: Unpin,
impl<Transport> !UnwindSafe for Upgrade<Transport>
Blanket Implementations§
§impl<R> AsyncReadExt for Rwhere
R: AsyncRead + ?Sized,
impl<R> AsyncReadExt for Rwhere
R: AsyncRead + ?Sized,
§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>where
Self: Unpin,
§fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self>where
Self: Unpin,
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self>where
Self: Unpin,
§fn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>
) -> ReadToEndFuture<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>
) -> ReadToEndFuture<'a, Self>where
Self: Unpin,
§fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self>where
Self: Unpin,
§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>where
Self: Unpin,
buf
. Read more§fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
limit
bytes from it. Read more