pub enum InlineHeader<O, B> {
Repr(O),
Raw(B),
}Expand description
A header which is either owned or read from a buffer.
Generated traits which allow reading/modifying/emitting either type
are re-implemented on the Packet types.
Variants§
Repr(O)
Owned representation of a header.
Raw(B)
Packed representation of a header, read from an existing buffer.
Implementations§
Source§impl<O, B> InlineHeader<O, B>
impl<O, B> InlineHeader<O, B>
Sourcepub fn repr(&self) -> Option<&O>
pub fn repr(&self) -> Option<&O>
Return a reference to this packet’s contents if they are owned.
Sourcepub fn repr_mut(&mut self) -> Option<&mut O>
pub fn repr_mut(&mut self) -> Option<&mut O>
Return a mutable reference to this packet’s contents if they are owned.
Trait Implementations§
Source§impl<O: Clone, B: Clone> Clone for InlineHeader<O, B>
impl<O: Clone, B: Clone> Clone for InlineHeader<O, B>
Source§fn clone(&self) -> InlineHeader<O, B>
fn clone(&self) -> InlineHeader<O, B>
Returns a duplicate 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<O: Emit, B: Emit> Emit for InlineHeader<O, B>
impl<O: Emit, B: Emit> Emit for InlineHeader<O, B>
Source§fn emit_raw<V: ByteSliceMut>(&self, buf: V) -> usize
fn emit_raw<V: ByteSliceMut>(&self, buf: V) -> usize
Writes this packet’s contents into a target buffer without
performing length checks. Read more
Source§fn needs_emit(&self) -> bool
fn needs_emit(&self) -> bool
Returns whether this packet needs a full re-emit, and
has not been simply modified in-place. Read more
Source§fn emit<V: ByteSliceMut>(&self, buf: V) -> ParseResult<usize>
fn emit<V: ByteSliceMut>(&self, buf: V) -> ParseResult<usize>
Writes this packet’s contents into a target buffer.
Source§fn emit_prefix<V: SplitByteSliceMut>(&self, buf: V) -> ParseResult<V>
fn emit_prefix<V: SplitByteSliceMut>(&self, buf: V) -> ParseResult<V>
Writes this packet’s contents into the start of a target buffer.
Source§fn emit_suffix<V: SplitByteSliceMut>(&self, buf: V) -> ParseResult<V>
fn emit_suffix<V: SplitByteSliceMut>(&self, buf: V) -> ParseResult<V>
Writes this packet’s contents at the end of a target buffer.
Source§fn emit_uninit(&self, buf: &mut [MaybeUninit<u8>]) -> ParseResult<usize>where
Self: EmitDoesNotRelyOnBufContents,
fn emit_uninit(&self, buf: &mut [MaybeUninit<u8>]) -> ParseResult<usize>where
Self: EmitDoesNotRelyOnBufContents,
Writes this packet’s contents into uninitialised memory.
Source§fn emit_vec(&self) -> Vec<u8>where
Self: EmitDoesNotRelyOnBufContents,
fn emit_vec(&self) -> Vec<u8>where
Self: EmitDoesNotRelyOnBufContents,
Writes this packet’s contents into a newly allocated
Vec of length
Header::packet_length, without zero-filling the contents. Read moreSource§impl<'a, T: HasView<V>, V> From<&'a InlineHeader<T, <T as HasView<V>>::ViewType>> for FieldRef<'a, T, V>
impl<'a, T: HasView<V>, V> From<&'a InlineHeader<T, <T as HasView<V>>::ViewType>> for FieldRef<'a, T, V>
Source§impl<'a, T: HasView<V>, V> From<&'a mut InlineHeader<T, <T as HasView<V>>::ViewType>> for FieldMut<'a, T, V>
impl<'a, T: HasView<V>, V> From<&'a mut InlineHeader<T, <T as HasView<V>>::ViewType>> for FieldMut<'a, T, V>
Source§impl<O, B> From<BoxedHeader<O, B>> for InlineHeader<O, B>
Available on crate feature alloc only.
impl<O, B> From<BoxedHeader<O, B>> for InlineHeader<O, B>
Available on crate feature
alloc only.Source§fn from(value: BoxedHeader<O, B>) -> Self
fn from(value: BoxedHeader<O, B>) -> Self
Converts to this type from the input type.
Source§impl<O, B> From<InlineHeader<O, B>> for BoxedHeader<O, B>
Available on crate feature alloc only.
impl<O, B> From<InlineHeader<O, B>> for BoxedHeader<O, B>
Available on crate feature
alloc only.Source§fn from(value: InlineHeader<O, B>) -> Self
fn from(value: InlineHeader<O, B>) -> Self
Converts to this type from the input type.
Source§impl<O, B> HasRepr for InlineHeader<O, B>
impl<O, B> HasRepr for InlineHeader<O, B>
Source§impl<O: HasView<V, ViewType = B>, B, V> HasView<V> for InlineHeader<O, B>
impl<O: HasView<V, ViewType = B>, B, V> HasView<V> for InlineHeader<O, B>
Source§impl<O, B> HeaderLen for InlineHeader<O, B>
impl<O, B> HeaderLen for InlineHeader<O, B>
Source§const MINIMUM_LENGTH: usize = O::MINIMUM_LENGTH
const MINIMUM_LENGTH: usize = O::MINIMUM_LENGTH
The minimum number of bytes a packet of this kind occupies
when serialised.
Source§fn packet_length(&self) -> usize
fn packet_length(&self) -> usize
The number of bytes which this packet would occupy when serialised. Read more
Source§impl<V: SplitByteSlice, B> HeaderParse<V> for InlineHeader<B::ReprType, B>
impl<V: SplitByteSlice, B> HeaderParse<V> for InlineHeader<B::ReprType, B>
Source§fn parse_choice(
from: V,
hint: Option<Self::Hint>,
) -> ParseResult<Success<Self, V>>
fn parse_choice( from: V, hint: Option<Self::Hint>, ) -> ParseResult<Success<Self, V>>
Parse a view-type from a given buffer, using a hint
Source§fn parse(from: B) -> ParseResult<Success<Self, B>>
fn parse(from: B) -> ParseResult<Success<Self, B>>
Parse a view-type from a given buffer.
Source§impl<O: NextLayer, B> NextLayer for InlineHeader<O, B>
impl<O: NextLayer, B> NextLayer for InlineHeader<O, B>
Source§impl<O: NextLayer + Clone, B: NextLayer<Denom = O::Denom, Hint = O::Hint> + ToOwnedPacket<Target = O>> ToOwnedPacket for InlineHeader<O, B>
impl<O: NextLayer + Clone, B: NextLayer<Denom = O::Denom, Hint = O::Hint> + ToOwnedPacket<Target = O>> ToOwnedPacket for InlineHeader<O, B>
impl<O: EmitDoesNotRelyOnBufContents, B: EmitDoesNotRelyOnBufContents> EmitDoesNotRelyOnBufContents for InlineHeader<O, B>
impl<O: Eq, B: Eq> Eq for InlineHeader<O, B>
impl<O, B> StructuralPartialEq for InlineHeader<O, B>
Auto Trait Implementations§
impl<O, B> Freeze for InlineHeader<O, B>
impl<O, B> RefUnwindSafe for InlineHeader<O, B>where
O: RefUnwindSafe,
B: RefUnwindSafe,
impl<O, B> Send for InlineHeader<O, B>
impl<O, B> Sync for InlineHeader<O, B>
impl<O, B> Unpin for InlineHeader<O, B>
impl<O, B> UnwindSafe for InlineHeader<O, B>where
O: UnwindSafe,
B: 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