Module extensions

Module extensions 

Source
Available on crate feature extensions only.
Expand description

Extensions used to store extra data in each socket instance.

It is heavily inspired by the http::Extensions type from the http crate.

The main difference is that the inner HashMap is wrapped with an RwLock to allow concurrent access. Moreover, any value extracted from the map is cloned before being returned.

This is necessary because Extensions are shared between all the threads that handle the same socket.

You can use the Extension or MaybeExtension extractor to extract an extension of the given type.

Structsยง

Extensions
A type map of protocol extensions.