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,
};
use super::frame::{Frame, FramedBinary};
use super::frame::{Frame, FramedMessage};
use super::proto::{CloseReason, OpCode};
use super::{Message, ProtocolError, WsWriter};
@ -529,7 +529,7 @@ pub struct ClientWriter {
impl ClientWriter {
/// Write payload
#[inline]
fn write(&mut self, mut data: FramedBinary) {
fn write(&mut self, mut data: FramedMessage) {
let inner = self.inner.borrow_mut();
if !inner.closed {
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 httprequest::HttpRequest;
use ws::frame::{Frame, FramedBinary};
use ws::frame::{Frame, FramedMessage};
use ws::proto::{CloseReason, OpCode};
use ws::{Message, ProtocolError, WsStream, WsWriter};
@ -138,7 +138,7 @@ where
/// data you should prefer the `text()` or `binary()` convenience functions
/// that handle the framing for you.
#[inline]
pub fn write_raw(&mut self, data: FramedBinary) {
pub fn write_raw(&mut self, data: FramedMessage) {
if !self.disconnected {
if self.stream.is_none() {
self.stream = Some(SmallVec::new());

View File

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