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
.source§impl<O, OO> OctetsFrom<Mandatory<O>> for Mandatory<OO>where
OO: OctetsFrom<O>,
impl<O, OO> OctetsFrom<Mandatory<O>> for Mandatory<OO>where
OO: OctetsFrom<O>,
type Error = <OO as OctetsFrom<O>>::Error
source§impl<'a, Octs> ParseSvcParamValue<'a, Octs> for Mandatory<Octs::Range<'a>>
impl<'a, Octs> ParseSvcParamValue<'a, Octs> for Mandatory<Octs::Range<'a>>
source§fn parse_value(
key: SvcParamKey,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_value( key: SvcParamKey, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
source§impl<Octs: ?Sized> SvcParamValue for Mandatory<Octs>
impl<Octs: ?Sized> SvcParamValue for Mandatory<Octs>
source§fn key(&self) -> SvcParamKey
fn key(&self) -> SvcParamKey
impl<Octs: AsRef<[u8]>> Eq for Mandatory<Octs>
Auto Trait Implementations§
impl<Octs> Freeze for Mandatory<Octs>
impl<Octs> RefUnwindSafe for Mandatory<Octs>where
Octs: RefUnwindSafe + ?Sized,
impl<Octs> Send for Mandatory<Octs>
impl<Octs> Sync for Mandatory<Octs>
impl<Octs> Unpin for Mandatory<Octs>
impl<Octs> UnwindSafe for Mandatory<Octs>where
Octs: UnwindSafe + ?Sized,
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)