diff options
Diffstat (limited to '')
-rw-r--r-- | packet/src/lib.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/packet/src/lib.rs b/packet/src/lib.rs index 6c9a097..c7a8eb9 100644 --- a/packet/src/lib.rs +++ b/packet/src/lib.rs @@ -28,8 +28,8 @@ pub use query::QueryType as PacketType; pub use question::DnsQuestion as PacketQuestion; impl Packet { - pub fn new() -> Packet { - Packet { + pub fn new() -> Self { + Self { header: DnsHeader::new(), questions: Vec::new(), answers: Vec::new(), @@ -38,8 +38,8 @@ impl Packet { } } - pub fn from_buffer(buffer: &mut PacketBuffer) -> Result<Packet> { - let mut result = Packet::new(); + pub fn from_buffer(buffer: &mut PacketBuffer) -> Result<Self> { + let mut result = Self::new(); result.header.read(buffer)?; for _ in 0..result.header.questions { @@ -138,7 +138,6 @@ impl Packet { _ => None, }) }) - .map(|addr| addr) // Finally, pick the first valid entry .next() } |