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
sourceimpl<Transport: AsyncRead + Unpin> AsyncRead for Upgrade<Transport>
impl<Transport: AsyncRead + Unpin> AsyncRead for Upgrade<Transport>
sourceimpl<Transport: AsyncWrite + Unpin> AsyncWrite for Upgrade<Transport>
impl<Transport: AsyncWrite + Unpin> AsyncWrite for Upgrade<Transport>
sourcefn 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 moresourcefn 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 mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>where
Self: Unpin,
fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self>where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self>where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self>where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self>where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self>where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self>where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>where
Self: Unpin,
buf
. Read morefn take(self, limit: u64) -> Take<Self>where
Self: Sized,
fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
limit
bytes from it. Read moreimpl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where
Self: Unpin,
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Transport for Twhere
T: Any + AsyncRead + AsyncWrite + Send + Sync + Unpin,
impl<T> Transport for Twhere
T: Any + AsyncRead + AsyncWrite + Send + Sync + Unpin,
sourcefn as_box_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<W> Write for Box<W, Global>where
W: Write + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn as_box_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<W> Write for Box<W, Global>where
W: Write + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
R: Read + ?Sized,impl<W> Write for Box<W, Global>where
W: Write + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Box<dyn Transport>
,
Transport requires implementing an as_box_any
function. Read more