pub struct Ipv4Hint<Octs: ?Sized>(/* private fields */);
Expand description
The ‘ipv4hint’ service parameter value.
This values provides a list of IPv4 addresses that the client may use to connect to the endpoint. The value is intended to speed up connecting but not to replace the A query to get the actual IPv4 addresses of the endpoint. That is, the client can start an A query and at the same time connect to an IP address from the value. If the A query doesn’t return this IP address, it may want to start again with an address from the response.
The type contains the value in its wire format which consists of the sequence of IPv4 addresses.
Implementations§
source§impl<Octs> Ipv4Hint<Octs>
impl<Octs> Ipv4Hint<Octs>
sourcepub unsafe fn from_octets_unchecked(octets: Octs) -> Self
pub unsafe fn from_octets_unchecked(octets: Octs) -> Self
Creates a new value from octets without checking.
§Safety
The caller has to ensure that octets
contains a properly
formated value of at most 65,535 octets.
source§impl Ipv4Hint<[u8]>
impl Ipv4Hint<[u8]>
sourcepub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self
pub unsafe fn from_slice_unchecked(slice: &[u8]) -> &Self
Creates a new value for a slice without checking.
§Safety
The caller has to ensure that slice
contains a properly
formated value of at most 65,535 octets.
source§impl<Octs: AsRef<[u8]> + ?Sized> Ipv4Hint<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> Ipv4Hint<Octs>
sourcepub fn iter(&self) -> Ipv4HintIter<'_, Octs> ⓘ
pub fn iter(&self) -> Ipv4HintIter<'_, Octs> ⓘ
Returns an iterator over the elements of the value.
source§impl<Octs: AsRef<[u8]>> Ipv4Hint<Octs>
impl<Octs: AsRef<[u8]>> Ipv4Hint<Octs>
sourcepub fn from_octets(octets: Octs) -> Result<Self, ParseError>
pub fn from_octets(octets: Octs) -> Result<Self, ParseError>
Creates a new ipv4hint value from its content.
The function returns an error if octets
doesn’t contain a
correctly encoded value or if it is longer than 65,535 octets.
sourcepub fn from_addrs(
addrs: impl IntoIterator<Item = Ipv4Addr>,
) -> Result<Self, BuildValueError>
pub fn from_addrs( addrs: impl IntoIterator<Item = Ipv4Addr>, ) -> Result<Self, BuildValueError>
Creates a new value from a list of IPv4 addresses.
The function will fail if the iterator returns more than 16,383 addresses or if the octets builder to be used for building runs out of space.
source§impl Ipv4Hint<[u8]>
impl Ipv4Hint<[u8]>
sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
pub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
Creates a new ipv4hint value from a slice of its content.
The function returns an error if slice
doesn’t contain a
correctly encoded value or if it is longer than 65,535 octets.
Trait Implementations§
source§impl<Octs: AsRef<[u8]> + ?Sized> ComposeSvcParamValue for Ipv4Hint<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> ComposeSvcParamValue for Ipv4Hint<Octs>
source§fn compose_len(&self) -> u16
fn compose_len(&self) -> u16
source§fn compose_value<Target: OctetsBuilder + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_value<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.