proto.rs
Rust test marker or harnessimports base64
SHA-256fd28425aa15fcefb886d2671b8f9dda58f4c61e17c89b97d333f5d4031cacecd
MaleculeMd₂(In₂Pa)
Evidence
1use base64;
2use sha1;
3use std::convert::{From, Into};
4use std::fmt;
5
6use self::OpCode::*;
7/// Operation codes as part of rfc6455.
8#[derive(Debug, Eq, PartialEq, Clone, Copy)]
9pub en …
22:37… was received.
23 Bad,
24}
25
26impl fmt::Display for OpCode {
27 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28 match *self {
29 …
69:3… _ => Bad,
70 }
71 }
72}
73
74use self::CloseCode::*;
75/// Status code used to indicate why an endpoint is closing the `WebSocket`
76/// connection.
77#[derive(Debug, Eq, PartialEq, Clone, Copy)]
78pub enum CloseCode {
79 /// Indicates a normal closure, meaning that the purpose for
80 /// which the connection was established has been fulfilled.
81 Normal,
…
216:30… bytes());
217
218 base64::encode(&hasher.digest().bytes())
219}
220
221#[cfg(test)]
222mod test {
223 #![allow(unused_imports, unused_variables, dead_code)]
224 use super::*;
225
226 macro_rules! opcode_into {
227 ($from:expr => $opcode:pat) => {
228 match …
240:20… > unreachable!("{:?}", e),
241 }
242 };
243 }
244
245 #[test]
246 fn test_to_opcode() {
247 opcode_into!(0 => OpCode::Continue);
248 opcode_into!(1 => OpCode::Text);
249 opc …