udp_request/response/response_binary/impl.rs
1use crate::*;
2
3impl ResponseTrait for UdpResponseBinary {
4 type OutputText = UdpResponseText;
5 type OutputBinary = UdpResponseBinary;
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) -> UdpResponseText {
19 let data: String = String::from_utf8_lossy(&self).to_string();
20 data
21 }
22}