pub struct SerialMessage { /* private fields */ }
Expand description
A DNS message in serialized form, with either the target address or source address
Implementations§
Source§impl SerialMessage
impl SerialMessage
Sourcepub fn new(message: Vec<u8>, addr: SocketAddr) -> Self
pub fn new(message: Vec<u8>, addr: SocketAddr) -> Self
Construct a new SerialMessage and the source or destination address
Sourcepub fn addr(&self) -> SocketAddr
pub fn addr(&self) -> SocketAddr
Get the source or destination address (context dependent)
Sourcepub fn into_parts(self) -> (Vec<u8>, SocketAddr)
pub fn into_parts(self) -> (Vec<u8>, SocketAddr)
Unwrap the Bytes and address
Sourcepub fn from_parts(message: Vec<u8>, addr: SocketAddr) -> Self
pub fn from_parts(message: Vec<u8>, addr: SocketAddr) -> Self
Build a SerialMessage
from some bytes and an address
Sourcepub fn to_message(&self) -> Result<Message, ProtoError>
pub fn to_message(&self) -> Result<Message, ProtoError>
Deserializes the inner data into a Message
Trait Implementations§
Source§impl From<(Vec<u8>, SocketAddr)> for SerialMessage
impl From<(Vec<u8>, SocketAddr)> for SerialMessage
Source§impl From<SerialMessage> for (Vec<u8>, SocketAddr)
impl From<SerialMessage> for (Vec<u8>, SocketAddr)
Source§fn from(msg: SerialMessage) -> Self
fn from(msg: SerialMessage) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SerialMessage
impl RefUnwindSafe for SerialMessage
impl Send for SerialMessage
impl Sync for SerialMessage
impl Unpin for SerialMessage
impl UnwindSafe for SerialMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more