This commit is contained in:
Luca Cappelletti 2025-03-09 16:11:39 +00:00 committed by GitHub
commit cbcdfa7e3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@
- Add `header::CLEAR_SITE_DATA` constant.
- Add `Extensions::get_or_insert[_with]()` methods.
- Add feature-gated `serde::Serialize` and `serde::Deserialize` implementations for `CloseCode` and `CloseReason`
### Changed

View File

@ -69,6 +69,8 @@ ws = [
"dep:sha1",
]
serde = ["dep:serde"]
# TLS via OpenSSL
openssl = ["__tls", "actix-tls/accept", "actix-tls/openssl"]
@ -121,6 +123,7 @@ language-tags = "0.3"
mime = "0.3.4"
percent-encoding = "2.1"
pin-project-lite = "0.2"
serde = { version = "1", features = ["derive"], optional = true }
smallvec = "1.6.1"
tokio = { version = "1.24.2", features = [] }
tokio-util = { version = "0.7", features = ["io", "codec"] }

View File

@ -83,6 +83,7 @@ impl From<u8> for OpCode {
/// Status code used to indicate why an endpoint is closing the WebSocket connection.
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum CloseCode {
/// Indicates a normal closure, meaning that the purpose for which the connection was
/// established has been fulfilled.
@ -195,6 +196,7 @@ impl From<u16> for CloseCode {
}
#[derive(Debug, Eq, PartialEq, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
/// Reason for closing the connection
pub struct CloseReason {
/// Exit code