pub struct UnknownOptData<Octs> { /* private fields */ }
Expand description
An OPT option in its raw form.
This type accepts any option type via its option code and raw data.
Implementations§
source§impl<Octs> UnknownOptData<Octs>
impl<Octs> UnknownOptData<Octs>
sourcepub fn new(code: OptionCode, data: Octs) -> Result<Self, LongOptData>
pub fn new(code: OptionCode, data: Octs) -> Result<Self, LongOptData>
Creates a new option from the code and data.
The function returns an error if data
is longer than 65,535 octets.
sourcepub unsafe fn new_unchecked(code: OptionCode, data: Octs) -> Self
pub unsafe fn new_unchecked(code: OptionCode, data: Octs) -> Self
Creates a new option data value without checking.
§Safety
The caller needs to make sure that data
is not longer than 65,535
octets.
sourcepub fn code(&self) -> OptionCode
pub fn code(&self) -> OptionCode
Returns the option code of the option.
Trait Implementations§
source§impl<Octs> AsRef<Octs> for UnknownOptData<Octs>
impl<Octs> AsRef<Octs> for UnknownOptData<Octs>
source§impl<Octs: Clone> Clone for UnknownOptData<Octs>
impl<Octs: Clone> Clone for UnknownOptData<Octs>
source§fn clone(&self) -> UnknownOptData<Octs>
fn clone(&self) -> UnknownOptData<Octs>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Octs: AsRef<[u8]>> ComposeOptData for UnknownOptData<Octs>
impl<Octs: AsRef<[u8]>> ComposeOptData for UnknownOptData<Octs>
fn compose_len(&self) -> u16
fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§impl<Octs, SrcOcts> OctetsFrom<UnknownOptData<SrcOcts>> for UnknownOptData<Octs>where
Octs: OctetsFrom<SrcOcts>,
impl<Octs, SrcOcts> OctetsFrom<UnknownOptData<SrcOcts>> for UnknownOptData<Octs>where
Octs: OctetsFrom<SrcOcts>,
type Error = <Octs as OctetsFrom<SrcOcts>>::Error
source§fn try_octets_from(src: UnknownOptData<SrcOcts>) -> Result<Self, Self::Error>
fn try_octets_from(src: UnknownOptData<SrcOcts>) -> Result<Self, Self::Error>
Performs the conversion.
source§impl<Octs: AsRef<[u8]>> OptData for UnknownOptData<Octs>
impl<Octs: AsRef<[u8]>> OptData for UnknownOptData<Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
Returns the option code associated with this option.
source§impl<'a, Octs> ParseOptData<'a, Octs> for UnknownOptData<Octs::Range<'a>>
impl<'a, Octs> ParseOptData<'a, Octs> for UnknownOptData<Octs::Range<'a>>
source§fn parse_option(
code: OptionCode,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
Parses the option code data. Read more
Auto Trait Implementations§
impl<Octs> Freeze for UnknownOptData<Octs>where
Octs: Freeze,
impl<Octs> RefUnwindSafe for UnknownOptData<Octs>where
Octs: RefUnwindSafe,
impl<Octs> Send for UnknownOptData<Octs>where
Octs: Send,
impl<Octs> Sync for UnknownOptData<Octs>where
Octs: Sync,
impl<Octs> Unpin for UnknownOptData<Octs>where
Octs: Unpin,
impl<Octs> UnwindSafe for UnknownOptData<Octs>where
Octs: UnwindSafe,
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.