pub fn prepare_upgrade(req: &mut Request<impl Body>) -> Option<OnUpgrade>Expand description
Prepares an HTTP upgrade on the given request.
This function removes the internal Upgrade token from the request’s
extensions and marks the connection as “to be upgraded”. The returned
OnUpgrade future resolves to the raw Upgraded I/O stream after the
server has sent the 101 Switching Protocols response.
Returns None if the request does not carry an upgrade token, which
happens when the connection handler was not configured to support upgrades
or the upgrade extension has already been consumed.
§Panics
Does not panic; returns None instead of panicking on missing state.