pub trait Address<A: Afi>:
Copy
+ Debug
+ Default
+ Hash
+ Ord
+ BitAnd<Self, Output = Self>
+ BitOr<Self, Output = Self>
+ BitXor<Self, Output = Self>
+ Add<Self, Output = Self>
+ CheckedAdd
+ Not<Output = Self>
+ Shl<Self::Length, Output = Self>
+ Shr<Self::Length, Output = Self>
+ 'static {
type Length: Length;
type LengthMap: LengthMap;
Show 18 associated constants and 8 methods
const MAX_LENGTH: Self::Length;
const ZERO: Self;
const ONES: Self;
const BROADCAST: Option<Self>;
const LOCALHOST: Self;
const UNSPECIFIED: Self;
const LOOPBACK_RANGE: RangeInclusive<Self>;
const BENCHMARK_RANGE: RangeInclusive<Self>;
const MULTICAST_RANGE: RangeInclusive<Self>;
const LINK_LOCAL_RANGE: RangeInclusive<Self>;
const PROTOCOL_ASSIGNMENTS_RANGE: RangeInclusive<Self>;
const DOCUMENTATION_RANGES: &'static [RangeInclusive<Self>];
const PRIVATE_RANGES: Option<&'static [RangeInclusive<Self>]>;
const RESERVED_RANGE: Option<RangeInclusive<Self>>;
const SHARED_RANGE: Option<RangeInclusive<Self>>;
const THISNET_RANGE: Option<RangeInclusive<Self>>;
const ULA_RANGE: Option<RangeInclusive<Self>>;
const MIN_LENGTH: Self::Length = <Self::Length>::ZERO;
// Required methods
fn leading_zeros(self) -> Self::Length;
fn to_be_bytes(self) -> A::Octets;
fn from_be_bytes(bytes: A::Octets) -> Self;
fn is_global(&self) -> bool;
fn parse_addr<S>(s: &S) -> Result<Self, Error>
where S: AsRef<str> + ?Sized;
fn parse_length<S>(s: &S) -> Result<Self::Length, Error>
where S: AsRef<str> + ?Sized;
fn parse_prefix<S>(s: &S) -> Result<(Self, Self::Length), Error>
where S: AsRef<str> + ?Sized;
fn parse_range<S>(
s: &S,
) -> Result<(Self, Self::Length, Self::Length, Self::Length), Error>
where S: AsRef<str> + ?Sized;
}Expand description
Underlying integer-like type used to represent an IP address.
Required Associated Constants§
Sourceconst MAX_LENGTH: Self::Length
const MAX_LENGTH: Self::Length
Maximum valid value of the underlying primitive value used to store prefix-lengths for this address-family.
Sourceconst BROADCAST: Option<Self>
const BROADCAST: Option<Self>
The primitive value of the subnet-local broadcast address, if it is defined for the address family.
Sourceconst UNSPECIFIED: Self
const UNSPECIFIED: Self
The primitive value of the “unspecified” address for this address family.
Sourceconst LOOPBACK_RANGE: RangeInclusive<Self>
const LOOPBACK_RANGE: RangeInclusive<Self>
The range of primitive address values defined for “loopback” use for this address family.
Sourceconst BENCHMARK_RANGE: RangeInclusive<Self>
const BENCHMARK_RANGE: RangeInclusive<Self>
The range of primitive address values defined for “benchmarking” use for this address family.
Sourceconst MULTICAST_RANGE: RangeInclusive<Self>
const MULTICAST_RANGE: RangeInclusive<Self>
The range of primitive address values defined for “multicast” use for this address family.
Sourceconst LINK_LOCAL_RANGE: RangeInclusive<Self>
const LINK_LOCAL_RANGE: RangeInclusive<Self>
The range of primitive address values defined for “link-local” use for this address family.
Sourceconst PROTOCOL_ASSIGNMENTS_RANGE: RangeInclusive<Self>
const PROTOCOL_ASSIGNMENTS_RANGE: RangeInclusive<Self>
The range of primitive address values reserved for IETF protocol assignments for this address family.
Sourceconst DOCUMENTATION_RANGES: &'static [RangeInclusive<Self>]
const DOCUMENTATION_RANGES: &'static [RangeInclusive<Self>]
The range of primitive address values defined for “documentation” use for this address family.
Sourceconst PRIVATE_RANGES: Option<&'static [RangeInclusive<Self>]>
const PRIVATE_RANGES: Option<&'static [RangeInclusive<Self>]>
The range of primitive address values defined for “private” use, if that is defined for this address family.
Sourceconst RESERVED_RANGE: Option<RangeInclusive<Self>>
const RESERVED_RANGE: Option<RangeInclusive<Self>>
The range of primitive address values reserved for future use, if that is defined for this address family.
Sourceconst SHARED_RANGE: Option<RangeInclusive<Self>>
const SHARED_RANGE: Option<RangeInclusive<Self>>
The range of primitive address values reserved for “shared” use, if that is defined for this address family.
Sourceconst THISNET_RANGE: Option<RangeInclusive<Self>>
const THISNET_RANGE: Option<RangeInclusive<Self>>
The range of primitive address values having “this network” semantics, if that is defined for this address family.
Sourceconst ULA_RANGE: Option<RangeInclusive<Self>>
const ULA_RANGE: Option<RangeInclusive<Self>>
The range of primitive address values defined as “unique local addresses”, if that is defined for this address family.
Provided Associated Constants§
Sourceconst MIN_LENGTH: Self::Length = <Self::Length>::ZERO
const MIN_LENGTH: Self::Length = <Self::Length>::ZERO
Minimum valid value of the underlying primitive value used to store prefix-lengths for this address-family.
Required Associated Types§
Required Methods§
Sourcefn leading_zeros(self) -> Self::Length
fn leading_zeros(self) -> Self::Length
Get the number of leading zeros in the binary representation of self.
Sourcefn to_be_bytes(self) -> A::Octets
fn to_be_bytes(self) -> A::Octets
Convert self to big-endian A::Octets.
Sourcefn from_be_bytes(bytes: A::Octets) -> Self
fn from_be_bytes(bytes: A::Octets) -> Self
Construct Self from big-endian A::Octets.
Sourcefn is_global(&self) -> bool
fn is_global(&self) -> bool
Returns true if this primitive value represents a “globally
routable” address, according to the address family semantics.
Sourcefn parse_addr<S>(s: &S) -> Result<Self, Error>
fn parse_addr<S>(s: &S) -> Result<Self, Error>
Parse a string into Self.
This method is primarily intended for use via the
FromStr implementation for
Address<A>.
§Errors
Fails if the string does not conform to the textual address
representation rules for A.
Sourcefn parse_length<S>(s: &S) -> Result<Self::Length, Error>
fn parse_length<S>(s: &S) -> Result<Self::Length, Error>
Parse a string into Self::Length.
This method is primarily intended for use via the
FromStr implementation for
PrefixLength<A>.
§Errors
Fails if the string does not conform to the textual address
representation rules for A.
Sourcefn parse_range<S>(
s: &S,
) -> Result<(Self, Self::Length, Self::Length, Self::Length), Error>
fn parse_range<S>( s: &S, ) -> Result<(Self, Self::Length, Self::Length, Self::Length), Error>
Parse a string into a (Self, Self::Length>, Self::Length, Self::Length) quad.
This method is primarily intended for use via the
FromStr implementation for
PrefixRange<A>.
§Errors
Fails if the string does not conform to the textual prefix
representation rules for A.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.