pub struct Mandatory<Octs: ?Sized>(/* private fields */);
Expand description
The “mandatory” service parameter value.
This value type lists the keys of the values that are considered essential for interpretation of the service binding. A client must understand all these keys in order be able to use a service bindings record.
A value of this type wraps an octets sequence that contains the
integer values of the keys in network byte order. You can create a
value of this type by providing an iterator over the keys to be
included to the from_keys
function. You can
get an iterator over the keys in an existing value through the
iter
method.
Implementations§
source§impl<Octs> Mandatory<Octs>
impl<Octs> Mandatory<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 Mandatory<[u8]>
impl Mandatory<[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> Mandatory<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> Mandatory<Octs>
sourcepub fn iter(&self) -> MandatoryIter<'_, Octs> ⓘ
pub fn iter(&self) -> MandatoryIter<'_, Octs> ⓘ
Returns an iterator over the elements of the value.
source§impl<Octs: AsRef<[u8]>> Mandatory<Octs>
impl<Octs: AsRef<[u8]>> Mandatory<Octs>
sourcepub fn from_octets(octets: Octs) -> Result<Self, ParseError>
pub fn from_octets(octets: Octs) -> Result<Self, ParseError>
Creates a new mandatory value from an octets sequence.
The function checks that the octets sequence contains a properly encoded value of at most 65,535 octets. It does not check whether there are any duplicates in the data.
source§impl Mandatory<[u8]>
impl Mandatory<[u8]>
sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
pub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
Creates a new mandatory value from an octets slice.
The function checks that the octets slice contains a properly encoded value of at most 65,535 octets. It does not check whether there are any duplicates in the data.
source§impl<Octs: AsRef<[u8]>> Mandatory<Octs>
impl<Octs: AsRef<[u8]>> Mandatory<Octs>
sourcepub fn from_keys(
keys: impl Iterator<Item = SvcParamKey>,
) -> Result<Self, BuildValueError>
pub fn from_keys( keys: impl Iterator<Item = SvcParamKey>, ) -> Result<Self, BuildValueError>
Creates a new value from a list of keys.
The created value will contain all the keys returned by the iterator in the order provided. The function does not check for duplicates.
Returns an error if the octets builder runs out of space or the resulting value would be longer than 65,535 octets.
Trait Implementations§
source§impl<Octs: AsRef<[u8]> + ?Sized> ComposeSvcParamValue for Mandatory<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> ComposeSvcParamValue for Mandatory<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
.