KeepRaw

Struct KeepRaw 

Source
pub struct KeepRaw<'b, T> { /* private fields */ }
Expand description

Decodes a struct while preserving original CBOR

§Examples

use pallas_codec::utils::KeepRaw;

let a = (123u16, (456u16, 789u16), 123u16);
let data = minicbor::to_vec(a).unwrap();

let (_, keeper, _): (u16, KeepRaw<(u16, u16)>, u16) = minicbor::decode(&data).unwrap();
let confirm: (u16, u16) = minicbor::decode(keeper.raw_cbor()).unwrap();
assert_eq!(confirm, (456u16, 789u16));

Implementations§

Source§

impl<'b, T> KeepRaw<'b, T>

Source

pub fn raw_cbor(&self) -> &'b [u8]

Source

pub fn unwrap(self) -> T

Trait Implementations§

Source§

impl<'b, T: Clone> Clone for KeepRaw<'b, T>

Source§

fn clone(&self) -> KeepRaw<'b, T>

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'b, T: Debug> Debug for KeepRaw<'b, T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'b, T, C> Decode<'b, C> for KeepRaw<'b, T>
where T: Decode<'b, C>,

Source§

fn decode(d: &mut Decoder<'b>, ctx: &mut C) -> Result<Self, Error>

Decode a value using the given Decoder. Read more
Source§

fn nil() -> Option<Self>

If possible, return a nil value of Self. Read more
Source§

impl<T> Deref for KeepRaw<'_, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<C, T> Encode<C> for KeepRaw<'_, T>

Source§

fn encode<W: Write>( &self, e: &mut Encoder<W>, _ctx: &mut C, ) -> Result<(), Error<W::Error>>

Encode a value of this type using the given Encoder. Read more
Source§

fn is_nil(&self) -> bool

Is this value of Self a nil value? Read more
Source§

impl<'b, T: Ord> Ord for KeepRaw<'b, T>

Source§

fn cmp(&self, other: &KeepRaw<'b, T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'b, T: PartialEq> PartialEq for KeepRaw<'b, T>

Source§

fn eq(&self, other: &KeepRaw<'b, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'b, T: PartialOrd> PartialOrd for KeepRaw<'b, T>

Source§

fn partial_cmp(&self, other: &KeepRaw<'b, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'b, T: Eq> Eq for KeepRaw<'b, T>

Source§

impl<'b, T> StructuralPartialEq for KeepRaw<'b, T>

Auto Trait Implementations§

§

impl<'b, T> Freeze for KeepRaw<'b, T>
where T: Freeze,

§

impl<'b, T> RefUnwindSafe for KeepRaw<'b, T>
where T: RefUnwindSafe,

§

impl<'b, T> Send for KeepRaw<'b, T>
where T: Send,

§

impl<'b, T> Sync for KeepRaw<'b, T>
where T: Sync,

§

impl<'b, T> Unpin for KeepRaw<'b, T>
where T: Unpin,

§

impl<'b, T> UnwindSafe for KeepRaw<'b, T>
where T: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

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

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.