tcp_request/response/response_text/
impl.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use super::r#type::TcpResponseText;
use crate::response::{r#trait::ResponseTrait, response_binary::r#type::TcpResponseBinary};

impl ResponseTrait for TcpResponseText {
    type OutputText = TcpResponseText;
    type OutputBinary = TcpResponseBinary;

    #[inline]
    fn from(response: &[u8]) -> Self::OutputText
    where
        Self: Sized,
    {
        <TcpResponseBinary as ResponseTrait>::from(response).text()
    }

    #[inline]
    fn text(&self) -> Self::OutputText {
        self.clone()
    }

    #[inline]
    fn binary(&self) -> TcpResponseBinary {
        self.clone().into_bytes()
    }
}