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§
Sourcetype OutputText: Clone + Sized
type OutputText: Clone + Sized
The associated type for the text representation of the response.
Sourcetype OutputBinary: Clone + Sized
type OutputBinary: Clone + Sized
The associated type for the binary representation of the response.
Required Methods§
Sourcefn text(&self) -> Self::OutputText
fn text(&self) -> Self::OutputText
Converts the response to its text format.
§Returns
Self::OutputText- The text representation of the response.
Sourcefn binary(&self) -> Self::OutputBinary
fn binary(&self) -> Self::OutputBinary
Returns the binary representation of the response.
§Returns
Self::OutputBinary- The binary representation of the response.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl ResponseTrait for UdpResponseBinary
Implements the ResponseTrait for UdpResponseBinary.
impl ResponseTrait for UdpResponseBinary
Implements the ResponseTrait for UdpResponseBinary.
type OutputText = String
type OutputBinary = Vec<u8>
Source§impl ResponseTrait for UdpResponseText
Implements the ResponseTrait for UdpResponseText.
impl ResponseTrait for UdpResponseText
Implements the ResponseTrait for UdpResponseText.