pub struct MockSocket {
pub url: String,
pub sec_protocol: Option<String>,
/* private fields */
}Expand description
A socket the test drives: it records what the client sends and delivers what the test receives on the server’s behalf.
Fields§
§url: StringThe URL the client opened.
sec_protocol: Option<String>The Sec-WebSocket-Protocol header it sent.
Implementations§
Source§impl MockSocket
impl MockSocket
Sourcepub fn close_code(&self) -> Option<u16>
pub fn close_code(&self) -> Option<u16>
The code the client closed the socket with.
Sourcepub fn receive(&self, message: SocketMessage)
pub fn receive(&self, message: SocketMessage)
Delivers a frame from the server.
Sourcepub fn receive_text(&self, text: &str)
pub fn receive_text(&self, text: &str)
Delivers a text frame from the server.
Sourcepub fn server_close(&self, code: u16, reason: &str, was_clean: bool)
pub fn server_close(&self, code: u16, reason: &str, was_clean: bool)
The socket closes from the server or network side.
Auto Trait Implementations§
impl !Freeze for MockSocket
impl !RefUnwindSafe for MockSocket
impl !Send for MockSocket
impl !Sync for MockSocket
impl !UnwindSafe for MockSocket
impl Forget for MockSocket
impl Move for MockSocket
impl Unpin for MockSocket
impl UnsafeUnpin for MockSocket
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