RawBytes

Struct RawBytes 

Source
pub struct RawBytes<B: ByteSlice>(/* private fields */);
Expand description

Newtype-wrapped buffers for use in Header view-types.

Trait Implementations§

Source§

impl<B: ByteSliceMut> AsMut<[u8]> for RawBytes<B>

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<B: ByteSlice> AsRef<[u8]> for RawBytes<B>

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<B: ByteSlice> Deref for RawBytes<B>

Source§

type Target = B

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<B: ByteSlice> DerefMut for RawBytes<B>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<B: ByteSlice> Emit for RawBytes<B>

Source§

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

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>

Writes this packet’s contents into a target buffer.
Source§

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>

Writes this packet’s contents at the end of a target buffer.
Source§

fn to_vec(&self) -> Vec<u8>

Writes this packet’s contents into a newly allocated Vec of length Header::packet_length. Read more
Source§

fn emit_uninit(&self, buf: &mut [MaybeUninit<u8>]) -> ParseResult<usize>

Writes this packet’s contents into uninitialised memory.
Source§

fn emit_vec(&self) -> Vec<u8>

Writes this packet’s contents into a newly allocated Vec of length Header::packet_length, without zero-filling the contents. Read more
Source§

impl<B: ByteSlice> From<B> for RawBytes<B>

Source§

fn from(value: B) -> Self

Converts to this type from the input type.
Source§

impl<B: ByteSlice> From<RawBytes<B>> for Vec<u8>

Source§

fn from(val: RawBytes<B>) -> Self

Converts to this type from the input type.
Source§

impl<B: ByteSlice> HeaderLen for RawBytes<B>

Source§

const MINIMUM_LENGTH: usize = 0usize

The minimum number of bytes a packet of this kind occupies when serialised.
Source§

fn packet_length(&self) -> usize

The number of bytes which this packet would occupy when serialised. Read more
Source§

impl<B: ByteSlice> EmitDoesNotRelyOnBufContents for RawBytes<B>

Auto Trait Implementations§

§

impl<B> Freeze for RawBytes<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for RawBytes<B>
where B: RefUnwindSafe,

§

impl<B> Send for RawBytes<B>
where B: Send,

§

impl<B> Sync for RawBytes<B>
where B: Sync,

§

impl<B> Unpin for RawBytes<B>
where B: Unpin,

§

impl<B> UnwindSafe for RawBytes<B>
where B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.