pub enum Event<'a> {
Head(Head),
Informational(Head),
Body(&'a [u8]),
Trailers(Vec<Header>),
End,
Upgrade,
}Variants§
Head(Head)
Informational(Head)
Body(&'a [u8])
Trailers(Vec<Header>)
End
The message is complete. Reads no input: see Step.
Upgrade
The message is complete, and it leaves HTTP/1 or asks to. Raised
instead of Event::End, with consumed == 0, as the last event of
the message. Every byte after it belongs to the next protocol, so the
host takes its retained input along.
Both Modes raise it:
Mode::Response: a101 Switching Protocols, or a2xxanswer to a request passed toDecoder::response_toasCONNECT. The switch has happened, so the decoder is neverreusableafterwards.Mode::Request: an HTTP/1.1 request with anUpgradeheader and theupgradetoken inConnection(RFC 9110 section 7.8), or anyCONNECTrequest. It follows the request body, if there is one. The switch has not happened: answering101(or2xxfor CONNECT) is the host’s decision. A host that accepts stops feeding this decoder. A host that declines sends an ordinary response and may carry on: the decoder isreusableon the same terms as afterEvent::End, andDecoder::resetresumes HTTP/1.
An Upgrade header on an HTTP/1.0 request is ignored, as RFC 9110
section 7.8 requires, and that request ends with Event::End.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for Event<'a>
impl<'a> Freeze for Event<'a>
impl<'a> RefUnwindSafe for Event<'a>
impl<'a> Send for Event<'a>
impl<'a> Sync for Event<'a>
impl<'a> Unpin for Event<'a>
impl<'a> UnsafeUnpin for Event<'a>
impl<'a> UnwindSafe for Event<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more