ResponseTrait

Trait ResponseTrait 

Source
pub trait ResponseTrait: Send + Debug {
    type OutputText: Clone + Sized;
    type OutputBinary: Clone + Sized;

    // Required methods
    fn text(&self) -> Self::OutputText;
    fn binary(&self) -> Self::OutputBinary;
    fn from(response: &[u8]) -> Self
       where Self: Sized;
}
Expand description

A trait for handling UDP responses.

This trait defines the common operations for processing UDP responses, including converting them to text or binary formats.

Required Associated Types§

Source

type OutputText: Clone + Sized

The associated type for the text representation of the response.

Source

type OutputBinary: Clone + Sized

The associated type for the binary representation of the response.

Required Methods§

Source

fn text(&self) -> Self::OutputText

Converts the response to its text format.

§Returns
  • Self::OutputText - The text representation of the response.
Source

fn binary(&self) -> Self::OutputBinary

Returns the binary representation of the response.

§Returns
  • Self::OutputBinary - The binary representation of the response.
Source

fn from(response: &[u8]) -> Self
where Self: Sized,

Creates a response instance from a byte slice.

§Arguments
  • &[u8] - The byte slice containing the response data.
§Returns
  • Self - A new instance of the response type.

Implementors§

Source§

impl ResponseTrait for UdpResponseBinary

Implements the ResponseTrait for UdpResponseBinary.

Source§

impl ResponseTrait for UdpResponseText

Implements the ResponseTrait for UdpResponseText.