|
1 |
| -//! ### Extractors for [`ConnectHandler`], [`ConnectMiddleware`], [`MessageHandler`] and [`DisconnectHandler`](crate::handler::DisconnectHandler). |
| 1 | +//! ### Extractors for [`ConnectHandler`], [`ConnectMiddleware`], |
| 2 | +//! [`MessageHandler`] and [`DisconnectHandler`](crate::handler::DisconnectHandler). |
2 | 3 | //!
|
3 | 4 | //! They can be used to extract data from the context of the handler and get specific params. Here are some examples of extractors:
|
4 | 5 | //! * [`Data`]: extracts and deserialize from any receieved data, if a deserialization error occurs the handler won't be called:
|
|
22 | 23 | //! (Similar to axum's [`extract::Extension`](https://docs.rs/axum/latest/axum/struct.Extension.html)
|
23 | 24 | //! * [`MaybeHttpExtension`]: extracts an http extension of the given type if it exists or [`None`] otherwise.
|
24 | 25 | //!
|
25 |
| -//! ### You can also implement your own Extractor with the [`FromConnectParts`], [`FromMessageParts`] and [`FromDisconnectParts`] traits |
26 |
| -//! When implementing these traits, if you clone the [`Arc<Socket>`](crate::socket::Socket) make sure that it is dropped at least when the socket is disconnected. |
27 |
| -//! Otherwise it will create a memory leak. It is why the [`SocketRef`] extractor is used instead of cloning the socket for common usage. |
| 26 | +//! ### You can also implement your own Extractor with the [`FromConnectParts`], [`FromMessageParts`] and |
| 27 | +//! [`FromDisconnectParts`] traits |
| 28 | +//! When implementing these traits, if you clone the [`Arc<Socket>`](crate::socket::Socket) make sure |
| 29 | +//! that it is dropped at least when the socket is disconnected. |
| 30 | +//! Otherwise it will create a memory leak. It is why the [`SocketRef`] extractor is used instead of cloning |
| 31 | +//! the socket for common usage. |
| 32 | +//! If you want to deserialize the [`Value`] data you must manually call the `Data` extractor to deserialize it. |
28 | 33 | //!
|
29 | 34 | //! [`FromConnectParts`]: crate::handler::FromConnectParts
|
30 | 35 | //! [`FromMessageParts`]: crate::handler::FromMessageParts
|
|
0 commit comments