hyper_util::server::conn::auto::upgrade

Function downcast

Source
pub fn downcast<T>(upgraded: Upgraded) -> Result<Parts<T>, Upgraded>
where T: Read + Write + Unpin + 'static,
Available on crate feature server and (crate features http1 or http2) only.
Expand description

Tries to downcast the internal trait object to the type passed.

On success, returns the downcasted parts. On error, returns the Upgraded back. This is a kludge to work around the fact that the machinery provided by [hyper_util::server::con::auto] wraps the inner T with a private type that is not reachable from outside the crate.

This kludge will be removed when this machinery is added back to the main hyper code.