1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-07-01 12:15:08 +02:00

re-introduce Body type, use Body as default body type for Response

This commit is contained in:
Nikolay Kim
2018-11-18 13:48:42 -08:00
parent 7fed50bcae
commit 8fea1367c7
16 changed files with 309 additions and 335 deletions

View File

@ -1,10 +1,9 @@
use bytes::BytesMut;
use bytes::{Bytes, BytesMut};
use tokio_codec::{Decoder, Encoder};
use super::frame::Parser;
use super::proto::{CloseReason, OpCode};
use super::ProtocolError;
use body::Binary;
/// `WebSocket` Message
#[derive(Debug, PartialEq)]
@ -12,7 +11,7 @@ pub enum Message {
/// Text message
Text(String),
/// Binary message
Binary(Binary),
Binary(Bytes),
/// Ping message
Ping(String),
/// Pong message

View File

@ -1,8 +1,7 @@
use byteorder::{ByteOrder, LittleEndian, NetworkEndian};
use bytes::{BufMut, BytesMut};
use bytes::{BufMut, Bytes, BytesMut};
use rand;
use body::Binary;
use ws::mask::apply_mask;
use ws::proto::{CloseCode, CloseReason, OpCode};
use ws::ProtocolError;
@ -151,7 +150,7 @@ impl Parser {
}
/// Generate binary representation
pub fn write_message<B: Into<Binary>>(
pub fn write_message<B: Into<Bytes>>(
dst: &mut BytesMut,
pl: B,
op: OpCode,