mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Update async-tungstenite version
This commit is contained in:
parent
edc85a0f66
commit
34902048d9
6 changed files with 25 additions and 386 deletions
|
|
@ -29,8 +29,8 @@ anyhow = "1"
|
|||
hashbrown = { version = "0.15", features = ["serde"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
simd-json = "0.13"
|
||||
tungstenite = { version = "0.21", optional = true }
|
||||
simd-json = "0.14"
|
||||
tungstenite = { version = "0.24", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.5"
|
||||
|
|
|
|||
|
|
@ -28,11 +28,13 @@ impl InMessage {
|
|||
|
||||
match ws_message {
|
||||
Message::Text(text) => {
|
||||
let mut text: Vec<u8> = text.into();
|
||||
let mut text: Vec<u8> = text.as_bytes().to_owned();
|
||||
|
||||
::simd_json::serde::from_slice(&mut text).context("deserialize with serde")
|
||||
}
|
||||
Message::Binary(mut bytes) => {
|
||||
Message::Binary(bytes) => {
|
||||
let mut bytes = bytes.to_vec();
|
||||
|
||||
::simd_json::serde::from_slice(&mut bytes[..]).context("deserialize with serde")
|
||||
}
|
||||
_ => Err(anyhow::anyhow!("Message is neither text nor binary")),
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ impl OutMessage {
|
|||
use tungstenite::Message::{Binary, Text};
|
||||
|
||||
let mut text: Vec<u8> = match message {
|
||||
Text(text) => text.into(),
|
||||
Binary(bytes) => String::from_utf8(bytes)?.into(),
|
||||
Text(text) => text.as_bytes().to_owned(),
|
||||
Binary(bytes) => String::from_utf8(bytes.to_vec())?.into(),
|
||||
_ => return Err(anyhow::anyhow!("Message is neither text nor bytes")),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue