Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion etherparse/src/link/ethernet2_header_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'a> Ethernet2HeaderSlice<'a> {
/// [`Ethernet2Header::LEN`]
#[inline]
#[cfg(feature = "std")]
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> Ethernet2HeaderSlice {
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> Ethernet2HeaderSlice<'_> {
debug_assert!(slice.len() == Ethernet2Header::LEN);
Ethernet2HeaderSlice { slice }
}
Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/link/linux_sll_header_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'a> LinuxSllHeaderSlice<'a> {
/// [`LinuxSllHeader::LEN`] and the fields are valid
#[inline]
#[cfg(feature = "std")]
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> LinuxSllHeaderSlice {
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> LinuxSllHeaderSlice<'_> {
debug_assert!(slice.len() == LinuxSllHeader::LEN);
LinuxSllHeaderSlice { slice }
}
Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/link/single_vlan_header_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'a> SingleVlanHeaderSlice<'a> {
/// The caller must ensured that the given slice has the length of
/// [`SingleVlanHeader::LEN`]
#[inline]
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> SingleVlanHeaderSlice {
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> SingleVlanHeaderSlice<'_> {
SingleVlanHeaderSlice { slice }
}

Expand Down
6 changes: 3 additions & 3 deletions etherparse/src/net/ip_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum IpSlice<'a> {

impl<'a> IpSlice<'a> {
/// Returns a reference to the `Ipv4Slice` if `self` is a `IpSlice::Ipv4`.
pub fn ipv4(&self) -> Option<&Ipv4Slice> {
pub fn ipv4(&self) -> Option<&Ipv4Slice<'_>> {
use IpSlice::*;
match self {
Ipv4(slice) => Some(slice),
Expand All @@ -24,7 +24,7 @@ impl<'a> IpSlice<'a> {
}

/// Returns a reference to the `Ipv6Slice` if `self` is a `IpSlice::Ipv6`.
pub fn ipv6(&self) -> Option<&Ipv6Slice> {
pub fn ipv6(&self) -> Option<&Ipv6Slice<'_>> {
use IpSlice::*;
match self {
Ipv4(_) => None,
Expand Down Expand Up @@ -83,7 +83,7 @@ impl<'a> IpSlice<'a> {
/// Separates and validates IP headers (including extension headers)
/// in the given slice and determine the sub-slice containing the payload
/// of the IP packet.
pub fn from_slice(slice: &[u8]) -> Result<IpSlice, err::ip::SliceError> {
pub fn from_slice(slice: &[u8]) -> Result<IpSlice<'_>, err::ip::SliceError> {
use crate::ip_number::AUTH;
use err::ip::{HeaderError::*, HeadersError::*, SliceError::*};
use IpSlice::*;
Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/net/ipv4_header_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl<'a> Ipv4HeaderSlice<'a> {
/// It must ensured that the slice exactly contains the IPv4 header
/// and the ihl (intra header length) & total length must be consistent.
#[inline]
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> Ipv4HeaderSlice {
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> Ipv4HeaderSlice<'_> {
Ipv4HeaderSlice { slice }
}

Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/net/ipv4_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl core::hash::Hash for Ipv4Options {

impl core::cmp::PartialOrd for Ipv4Options {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
Some(self.as_slice().cmp(other.as_slice()))
Some(self.cmp(other))
}
}

Expand Down
6 changes: 3 additions & 3 deletions etherparse/src/net/ipv4_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> Ipv4Slice<'a> {
///
/// If you want to ignore these kind of length errors based on the length
/// fields in the IP headers use [`crate::LaxIpv4Slice::from_slice`] instead.
pub fn from_slice(slice: &[u8]) -> Result<Ipv4Slice, SliceError> {
pub fn from_slice(slice: &[u8]) -> Result<Ipv4Slice<'_>, SliceError> {
use crate::ip_number::AUTH;

// decode the header
Expand Down Expand Up @@ -118,13 +118,13 @@ impl<'a> Ipv4Slice<'a> {

/// Returns a slice containing the IPv4 header.
#[inline]
pub fn header(&self) -> Ipv4HeaderSlice {
pub fn header(&self) -> Ipv4HeaderSlice<'_> {
self.header
}

/// Returns a slice containing the IPv4 extension headers.
#[inline]
pub fn extensions(&self) -> Ipv4ExtensionsSlice {
pub fn extensions(&self) -> Ipv4ExtensionsSlice<'_> {
self.exts
}

Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/net/ipv6_header_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<'a> Ipv6HeaderSlice<'a> {
///
/// It must ensured that the slice length is at least [`Ipv6Header::LEN`].
#[inline]
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> Ipv6HeaderSlice {
pub(crate) unsafe fn from_slice_unchecked(slice: &[u8]) -> Ipv6HeaderSlice<'_> {
Ipv6HeaderSlice { slice }
}

Expand Down
6 changes: 3 additions & 3 deletions etherparse/src/net/lax_ip_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub enum LaxIpSlice<'a> {

impl<'a> LaxIpSlice<'a> {
/// Returns a reference to the `Ipv4Slice` if `self` is a `IpSlice::Ipv4`.
pub fn ipv4(&self) -> Option<&LaxIpv4Slice> {
pub fn ipv4(&self) -> Option<&LaxIpv4Slice<'_>> {
use LaxIpSlice::*;
match self {
Ipv4(slice) => Some(slice),
Expand All @@ -33,7 +33,7 @@ impl<'a> LaxIpSlice<'a> {
}

/// Returns a reference to the `Ipv6Slice` if `self` is a `IpSlice::Ipv6`.
pub fn ipv6(&self) -> Option<&LaxIpv6Slice> {
pub fn ipv6(&self) -> Option<&LaxIpv6Slice<'_>> {
use LaxIpSlice::*;
match self {
Ipv4(_) => None,
Expand Down Expand Up @@ -141,7 +141,7 @@ impl<'a> LaxIpSlice<'a> {
slice: &[u8],
) -> Result<
(
LaxIpSlice,
LaxIpSlice<'_>,
Option<(err::ipv6_exts::HeaderSliceError, err::Layer)>,
),
err::ip::LaxHeaderSliceError,
Expand Down
10 changes: 6 additions & 4 deletions etherparse/src/net/lax_ipv4_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ impl<'a> LaxIpv4Slice<'a> {
/// is set to [`LenSource::Ipv4HeaderTotalLen`].
pub fn from_slice(
slice: &[u8],
) -> Result<(LaxIpv4Slice, Option<err::ip_auth::HeaderSliceError>), err::ipv4::HeaderSliceError>
{
) -> Result<
(LaxIpv4Slice<'_>, Option<err::ip_auth::HeaderSliceError>),
err::ipv4::HeaderSliceError,
> {
use crate::ip_number::AUTH;

// decode the header
Expand Down Expand Up @@ -197,13 +199,13 @@ impl<'a> LaxIpv4Slice<'a> {

/// Returns a slice containing the IPv4 header.
#[inline]
pub fn header(&self) -> Ipv4HeaderSlice {
pub fn header(&self) -> Ipv4HeaderSlice<'_> {
self.header
}

/// Returns a slice containing the IPv4 extension headers.
#[inline]
pub fn extensions(&self) -> Ipv4ExtensionsSlice {
pub fn extensions(&self) -> Ipv4ExtensionsSlice<'_> {
self.exts
}

Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/net/net_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<'a> NetSlice<'a> {

/// Returns references to the ARP packet slice if the slice contains an ARP values.
#[inline]
pub fn arp_ref(&self) -> Option<&ArpPacketSlice> {
pub fn arp_ref(&self) -> Option<&ArpPacketSlice<'_>> {
if let NetSlice::Arp(arp) = self {
Some(arp)
} else {
Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/packet_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ impl<'a> PacketHeaders<'a> {
/// }
/// }
/// ```
pub fn from_ip_slice(slice: &[u8]) -> Result<PacketHeaders, err::packet::SliceError> {
pub fn from_ip_slice(slice: &[u8]) -> Result<PacketHeaders<'_>, err::packet::SliceError> {
use err::packet::SliceError::*;

// read ip headers
Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/transport/tcp_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl TcpHeader {
/// Returns an iterator that allows to iterate through all
/// known TCP header options.
#[inline]
pub fn options_iterator(&self) -> TcpOptionsIterator {
pub fn options_iterator(&self) -> TcpOptionsIterator<'_> {
self.options.elements_iter()
}

Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/transport/tcp_header_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl<'a> TcpHeaderSlice<'a> {

/// Returns an iterator that allows to iterate through all known TCP header options.
#[inline]
pub fn options_iterator(&self) -> TcpOptionsIterator {
pub fn options_iterator(&self) -> TcpOptionsIterator<'_> {
TcpOptionsIterator::from_slice(self.options())
}

Expand Down
4 changes: 2 additions & 2 deletions etherparse/src/transport/tcp_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ impl TcpOptions {
/// assert_eq!(v, vec![Ok(WindowScale(123)), Ok(Noop), Ok(Noop)]);
/// ```
#[inline]
pub fn elements_iter(&self) -> TcpOptionsIterator {
pub fn elements_iter(&self) -> TcpOptionsIterator<'_> {
TcpOptionsIterator {
options: self.as_slice(),
}
Expand Down Expand Up @@ -512,7 +512,7 @@ impl core::hash::Hash for TcpOptions {

impl core::cmp::PartialOrd for TcpOptions {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
Some(self.as_slice().cmp(other.as_slice()))
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/transport/tcp_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl<'a> TcpSlice<'a> {

/// Returns an iterator that allows to iterate through all known TCP header options.
#[inline]
pub fn options_iterator(&self) -> TcpOptionsIterator {
pub fn options_iterator(&self) -> TcpOptionsIterator<'_> {
TcpOptionsIterator::from_slice(self.options())
}

Expand Down