mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
ws protocol: make tungstenite integration optional feature
This commit is contained in:
parent
fee465d205
commit
3c906f48ee
4 changed files with 9 additions and 1 deletions
|
|
@ -12,6 +12,10 @@ rust-version.workspace = true
|
|||
|
||||
readme = "./README.md"
|
||||
|
||||
[features]
|
||||
default = ["tungstenite"]
|
||||
tungstenite = ["dep:tungstenite"]
|
||||
|
||||
[lib]
|
||||
name = "aquatic_ws_protocol"
|
||||
|
||||
|
|
@ -26,7 +30,7 @@ hashbrown = { version = "0.14", features = ["serde"] }
|
|||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
simd-json = "0.13"
|
||||
tungstenite = "0.21"
|
||||
tungstenite = { version = "0.21", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.5"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ pub enum InMessage {
|
|||
ScrapeRequest(ScrapeRequest),
|
||||
}
|
||||
|
||||
#[cfg(feature = "tungstenite")]
|
||||
impl InMessage {
|
||||
#[inline]
|
||||
pub fn to_ws_message(&self) -> ::tungstenite::Message {
|
||||
|
|
|
|||
|
|
@ -227,6 +227,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "tungstenite")]
|
||||
#[quickcheck]
|
||||
fn quickcheck_serde_identity_in_message(in_message_1: InMessage) -> bool {
|
||||
let ws_message = in_message_1.to_ws_message();
|
||||
|
|
@ -246,6 +247,7 @@ mod tests {
|
|||
success
|
||||
}
|
||||
|
||||
#[cfg(feature = "tungstenite")]
|
||||
#[quickcheck]
|
||||
fn quickcheck_serde_identity_out_message(out_message_1: OutMessage) -> bool {
|
||||
let ws_message = out_message_1.to_ws_message();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ pub enum OutMessage {
|
|||
ErrorResponse(ErrorResponse),
|
||||
}
|
||||
|
||||
#[cfg(feature = "tungstenite")]
|
||||
impl OutMessage {
|
||||
#[inline]
|
||||
pub fn to_ws_message(&self) -> tungstenite::Message {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue