Skip to content

Commit

Permalink
re-export Utf8Bytes, Bytes at root
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheretic authored and daniel-abramov committed Dec 17, 2024
1 parent 6505e51 commit 63db5e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ type ReadBuffer = buffer::ReadBuffer<READ_BUFFER_CHUNK_SIZE>;

pub use crate::{
error::{Error, Result},
protocol::{Message, WebSocket},
protocol::{frame::Utf8Bytes, Message, WebSocket},
};
// re-export bytes since used in `Message` API.
pub use bytes::Bytes;

#[cfg(feature = "handshake")]
pub use crate::{
Expand Down
7 changes: 5 additions & 2 deletions src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use self::{
},
message::{IncompleteMessage, IncompleteMessageType},
};
use crate::error::{CapacityError, Error, ProtocolError, Result};
use crate::{
error::{CapacityError, Error, ProtocolError, Result},
protocol::frame::Utf8Bytes,
};
use log::*;
use std::{
io::{self, Read, Write},
Expand Down Expand Up @@ -713,7 +716,7 @@ impl WebSocketContext {
if !frame.code.is_allowed() {
CloseFrame {
code: CloseCode::Protocol,
reason: "Protocol violation".into(),
reason: Utf8Bytes::from_static("Protocol violation"),
}
} else {
frame
Expand Down

0 comments on commit 63db5e9

Please sign in to comment.