tcp_request/response/response_binary/impl.rs
1use crate::*;
2
3impl ResponseTrait for TcpResponseBinary {
4 type OutputText = TcpResponseText;
5 type OutputBinary = TcpResponseBinary;
6
7 fn from(response: &[u8]) -> Self
8 where
9 Self: Sized,
10 {
11 response.to_vec()
12 }
13
14 fn binary(&self) -> Self::OutputBinary {
15 self.clone()
16 }
17
18 fn text(&self) -> TcpResponseText {
19 let data: String = String::from_utf8_lossy(&self).to_string();
20 data
21 }
22}