mirror of https://github.com/fafhrd91/actix-web
Added serde derive to close reason and close code
This commit is contained in:
parent
9656383646
commit
09dfb88722
|
@ -69,6 +69,8 @@ ws = [
|
||||||
"dep:sha1",
|
"dep:sha1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
serde = ["dep:serde"]
|
||||||
|
|
||||||
# TLS via OpenSSL
|
# TLS via OpenSSL
|
||||||
openssl = ["__tls", "actix-tls/accept", "actix-tls/openssl"]
|
openssl = ["__tls", "actix-tls/accept", "actix-tls/openssl"]
|
||||||
|
|
||||||
|
@ -121,6 +123,7 @@ language-tags = "0.3"
|
||||||
mime = "0.3.4"
|
mime = "0.3.4"
|
||||||
percent-encoding = "2.1"
|
percent-encoding = "2.1"
|
||||||
pin-project-lite = "0.2"
|
pin-project-lite = "0.2"
|
||||||
|
serde = { version = "1", features = ["derive"], optional = true }
|
||||||
smallvec = "1.6.1"
|
smallvec = "1.6.1"
|
||||||
tokio = { version = "1.24.2", features = [] }
|
tokio = { version = "1.24.2", features = [] }
|
||||||
tokio-util = { version = "0.7", features = ["io", "codec"] }
|
tokio-util = { version = "0.7", features = ["io", "codec"] }
|
||||||
|
|
|
@ -83,6 +83,7 @@ impl From<u8> for OpCode {
|
||||||
|
|
||||||
/// Status code used to indicate why an endpoint is closing the WebSocket connection.
|
/// Status code used to indicate why an endpoint is closing the WebSocket connection.
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
|
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum CloseCode {
|
pub enum CloseCode {
|
||||||
/// Indicates a normal closure, meaning that the purpose for which the connection was
|
/// Indicates a normal closure, meaning that the purpose for which the connection was
|
||||||
/// established has been fulfilled.
|
/// established has been fulfilled.
|
||||||
|
@ -195,6 +196,7 @@ impl From<u16> for CloseCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
/// Reason for closing the connection
|
/// Reason for closing the connection
|
||||||
pub struct CloseReason {
|
pub struct CloseReason {
|
||||||
/// Exit code
|
/// Exit code
|
||||||
|
|
Loading…
Reference in New Issue