ws/frame: Rename `FramedBinary` type to `FramedMessage`

This commit is contained in:
Tobias Bieniek 2018-07-19 11:40:09 +02:00
parent 6fc084a07c
commit d5c27d6b63
3 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ use client::{
Pipeline, SendRequest, SendRequestError, Pipeline, SendRequest, SendRequestError,
}; };
use super::frame::{Frame, FramedBinary}; use super::frame::{Frame, FramedMessage};
use super::proto::{CloseReason, OpCode}; use super::proto::{CloseReason, OpCode};
use super::{Message, ProtocolError, WsWriter}; use super::{Message, ProtocolError, WsWriter};
@ -529,7 +529,7 @@ pub struct ClientWriter {
impl ClientWriter { impl ClientWriter {
/// Write payload /// Write payload
#[inline] #[inline]
fn write(&mut self, mut data: FramedBinary) { fn write(&mut self, mut data: FramedMessage) {
let inner = self.inner.borrow_mut(); let inner = self.inner.borrow_mut();
if !inner.closed { if !inner.closed {
let _ = inner.tx.unbounded_send(data.0.take()); let _ = inner.tx.unbounded_send(data.0.take());

View File

@ -20,7 +20,7 @@ use context::{ActorHttpContext, Drain, Frame as ContextFrame};
use error::{Error, ErrorInternalServerError, PayloadError}; use error::{Error, ErrorInternalServerError, PayloadError};
use httprequest::HttpRequest; use httprequest::HttpRequest;
use ws::frame::{Frame, FramedBinary}; use ws::frame::{Frame, FramedMessage};
use ws::proto::{CloseReason, OpCode}; use ws::proto::{CloseReason, OpCode};
use ws::{Message, ProtocolError, WsStream, WsWriter}; use ws::{Message, ProtocolError, WsStream, WsWriter};
@ -138,7 +138,7 @@ where
/// data you should prefer the `text()` or `binary()` convenience functions /// data you should prefer the `text()` or `binary()` convenience functions
/// that handle the framing for you. /// that handle the framing for you.
#[inline] #[inline]
pub fn write_raw(&mut self, data: FramedBinary) { pub fn write_raw(&mut self, data: FramedMessage) {
if !self.disconnected { if !self.disconnected {
if self.stream.is_none() { if self.stream.is_none() {
self.stream = Some(SmallVec::new()); self.stream = Some(SmallVec::new());

View File

@ -28,7 +28,7 @@ impl Frame {
/// Create a new Close control frame. /// Create a new Close control frame.
#[inline] #[inline]
pub fn close(reason: Option<CloseReason>, genmask: bool) -> FramedBinary { pub fn close(reason: Option<CloseReason>, genmask: bool) -> FramedMessage {
let payload = match reason { let payload = match reason {
None => Vec::new(), None => Vec::new(),
Some(reason) => { Some(reason) => {
@ -295,7 +295,7 @@ impl Frame {
/// Generate binary representation /// Generate binary representation
pub fn message<B: Into<Binary>>( pub fn message<B: Into<Binary>>(
data: B, code: OpCode, finished: bool, genmask: bool, data: B, code: OpCode, finished: bool, genmask: bool,
) -> FramedBinary { ) -> FramedMessage {
let payload = data.into(); let payload = data.into();
let one: u8 = if finished { let one: u8 = if finished {
0x80 | Into::<u8>::into(code) 0x80 | Into::<u8>::into(code)
@ -337,7 +337,7 @@ impl Frame {
buf.into() buf.into()
}; };
FramedBinary(binary) FramedMessage(binary)
} }
} }
@ -376,7 +376,7 @@ impl fmt::Display for Frame {
/// A `Binary` representing a `WebSocket` message with framing. /// A `Binary` representing a `WebSocket` message with framing.
#[derive(Debug)] #[derive(Debug)]
pub struct FramedBinary(pub Binary); pub struct FramedMessage(pub Binary);
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {