Struct AnyExtension

pub struct AnyExtension(pub u8);

A newtype wrapper around an arbitrary extension ID.

An extension is some amount of byte data organized in sub-blocks so that one can skip over it without knowing the semantics. Though technically you likely want to use a Application extension, the library tries to stay flexible here.

This allows us to customize the set of impls compared to a raw u8. It also clarifies the intent and gives some inherent methods for interoperability with known extension types.

Fields

0: u8

Implementations

impl AnyExtension

const fn into_known(self) -> Option<Extension>

Decode the label as a known extension.

Trait Implementations

impl Clone for AnyExtension

fn clone(&self) -> AnyExtension

impl Copy for AnyExtension

impl Debug for AnyExtension

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for AnyExtension

impl From<Extension> for AnyExtension

fn from(ext: Extension) -> Self

impl Hash for AnyExtension

fn hash<__H: Hasher>(&self, state: &mut __H)

impl PartialEq for AnyExtension

fn eq(&self, other: &AnyExtension) -> bool

impl StructuralPartialEq for AnyExtension

Auto Trait Implementations

impl Freeze for AnyExtension

impl RefUnwindSafe for AnyExtension

impl Send for AnyExtension

impl Sync for AnyExtension

impl Unpin for AnyExtension

impl UnsafeUnpin for AnyExtension

impl UnwindSafe for AnyExtension

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for AnyExtension where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for AnyExtension

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for AnyExtension where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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