udp_request/request/trait.rs
1use crate::*;
2
3/// A trait for sending UDP requests.
4///
5/// This trait defines the core functionality for sending data over UDP.
6/// It requires the `Send` and `Debug` traits.
7pub trait RequestTrait: Send + Debug {
8 /// The result type for the request operation.
9 ///
10 /// This associated type must be `Sized`.
11 type RequestResult: Sized;
12
13 /// Sends data through the UDP socket.
14 ///
15 /// # Arguments
16 ///
17 /// - `&[u8]` - The data to be sent as a byte slice.
18 ///
19 /// # Returns
20 ///
21 /// - `Self::RequestResult` - The result of the send operation, as defined by the implementor.
22 fn send(&mut self, data: &[u8]) -> Self::RequestResult;
23}