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