pub struct AddressRange { /* private fields */ }Expand description
A contiguous range of addresses (used as interval-tree keys).
A range of addresses corresponding to some NetAddress.
The only way to create an instance of AddressRange is from a
NetAddress or Address, thus only valid ranges are represented by
this type.
This type can be used as a key in a key-value collection that uses Ord for
its keys. (NB: the equality is defined as “if the ranges overlap — they
are equal”)
Because overlap-as-equality is not transitive, this Ord is a valid total
order only over a set of disjoint ranges. That is the intended use: a
point range (from(Address)) compares equal to the single disjoint subnet
that contains it, which is how the runtime looks a subnet up by address. Any
collection keyed by AddressRange must keep its keys disjoint (callers
check for overlap before inserting); mixing overlapping-but-distinct ranges
makes lookups unspecified.
Implementations§
Trait Implementations§
Source§impl Clone for AddressRange
impl Clone for AddressRange
Source§fn clone(&self) -> AddressRange
fn clone(&self) -> AddressRange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AddressRange
Source§impl Debug for AddressRange
impl Debug for AddressRange
Source§impl Display for AddressRange
impl Display for AddressRange
impl Eq for AddressRange
Source§impl From<Address> for AddressRange
impl From<Address> for AddressRange
Source§fn from(addr: Address) -> AddressRange
fn from(addr: Address) -> AddressRange
Source§impl From<AddressRange> for NetAddress
impl From<AddressRange> for NetAddress
Source§fn from(range: AddressRange) -> NetAddress
fn from(range: AddressRange) -> NetAddress
Source§impl From<NetAddress> for AddressRange
impl From<NetAddress> for AddressRange
Source§fn from(net: NetAddress) -> AddressRange
fn from(net: NetAddress) -> AddressRange
Source§impl Ord for AddressRange
impl Ord for AddressRange
Source§fn cmp(&self, other: &AddressRange) -> Ordering
fn cmp(&self, other: &AddressRange) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for AddressRange
impl PartialEq for AddressRange
Source§fn eq(&self, other: &AddressRange) -> bool
fn eq(&self, other: &AddressRange) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for AddressRange
impl PartialOrd for AddressRange
Auto Trait Implementations§
impl Freeze for AddressRange
impl RefUnwindSafe for AddressRange
impl Send for AddressRange
impl Sync for AddressRange
impl Unpin for AddressRange
impl UnsafeUnpin for AddressRange
impl UnwindSafe for AddressRange
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self to key and returns true if they are equal.impl<K> ErrorKind for K
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more