aboutsummaryrefslogtreecommitdiff
path: root/src/message.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/message.rs')
-rw-r--r--src/message.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/message.rs b/src/message.rs
index dbcc857..6d50254 100644
--- a/src/message.rs
+++ b/src/message.rs
@@ -192,8 +192,8 @@ impl Framing {
// required because otherwise the borrow-checker complains
let Framing { direct, stream } = self;
- let res = stream::once(async move { Ok(u32::to_be_bytes(len).to_vec()) })
- .chain(stream::once(async move { Ok(direct) }));
+ let res = stream::once(async move { Ok(u32::to_be_bytes(len).to_vec().into()) })
+ .chain(stream::once(async move { Ok(direct.into()) }));
if let Some(stream) = stream {
Box::pin(res.chain(stream))
@@ -217,7 +217,7 @@ impl Framing {
let mut len = [0; 4];
len.copy_from_slice(&packet[..4]);
let len = u32::from_be_bytes(len);
- packet.drain(..4);
+ packet = packet.slice(4..);
let mut buffer = Vec::new();
let len = len as usize;
@@ -226,7 +226,7 @@ impl Framing {
buffer.extend_from_slice(&packet[..max_cp]);
if buffer.len() == len {
- packet.drain(..max_cp);
+ packet = packet.slice(max_cp..);
break;
}
packet = stream