some optimizations and muxprotocolextensionstream for stream id 0

This commit is contained in:
Toshit Chawda 2024-04-27 17:36:06 -07:00
parent 3b8dedeba2
commit b3f35b232f
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
7 changed files with 237 additions and 170 deletions

View file

@ -30,7 +30,7 @@ impl From<Frame<'_>> for crate::ws::Frame {
Self {
finished: frame.fin,
opcode: frame.opcode.into(),
payload: BytesMut::from(frame.payload.deref()).freeze(),
payload: BytesMut::from(frame.payload.deref()),
}
}
}
@ -38,7 +38,7 @@ impl From<Frame<'_>> for crate::ws::Frame {
impl<'a> From<crate::ws::Frame> for Frame<'a> {
fn from(frame: crate::ws::Frame) -> Self {
use crate::ws::OpCode::*;
let payload = Payload::Owned(frame.payload.into());
let payload = Payload::Bytes(frame.payload);
match frame.opcode {
Text => Self::text(payload),
Binary => Self::binary(payload),