mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 02:05:30 +00:00
Update async-tungstenite version
This commit is contained in:
parent
edc85a0f66
commit
34902048d9
6 changed files with 25 additions and 386 deletions
|
|
@ -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