pub struct WebSocketBridge {
pub outgoing: VecDeque<WsFrame>,
pub incoming: VecDeque<WsFrame>,
pub connected: bool,
pub max_frame_size: usize,
}Expand description
WebSocket bridge for text/binary frame framing.
Fields§
§outgoing: VecDeque<WsFrame>Buffered outgoing frames.
incoming: VecDeque<WsFrame>Buffered incoming frames.
connected: boolConnection state.
max_frame_size: usizeMax frame size.
Implementations§
Source§impl WebSocketBridge
impl WebSocketBridge
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Disconnect.
Sourcepub fn send_binary(&mut self, data: Vec<u8>)
pub fn send_binary(&mut self, data: Vec<u8>)
Send binary frame.
Sourcepub fn recv_frame(&mut self) -> Option<WsFrame>
pub fn recv_frame(&mut self) -> Option<WsFrame>
Receive next frame.
Sourcepub fn inject_frame(&mut self, frame: WsFrame)
pub fn inject_frame(&mut self, frame: WsFrame)
Inject an incoming frame (for testing).
Sourcepub fn pending_out(&self) -> usize
pub fn pending_out(&self) -> usize
Number of pending outgoing frames.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebSocketBridge
impl RefUnwindSafe for WebSocketBridge
impl Send for WebSocketBridge
impl Sync for WebSocketBridge
impl Unpin for WebSocketBridge
impl UnsafeUnpin for WebSocketBridge
impl UnwindSafe for WebSocketBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.