Skip to main content

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 for KeepRaw<'b, T>
where T: Clone,

Source§

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

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

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

Source§

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

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<KeepRaw<'b, T>, 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) -> &<KeepRaw<'_, T> as Deref>::Target

Dereferences the value.
Source§

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

Source§

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

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 From<KeepRaw<'_, NativeScript>> for MemoizedNativeScript

Source§

fn from(script: KeepRaw<'_, NativeScript>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<KeepRaw<'a, HeaderBody>> for HeaderBody

Source§

fn from(x: KeepRaw<'a, HeaderBody>) -> HeaderBody

Converts to this type from the input type.
Source§

impl<'a> From<KeepRaw<'a, PseudoHeader<KeepRaw<'a, HeaderBody>>>> for PseudoHeader<HeaderBody>

Source§

fn from( x: KeepRaw<'a, PseudoHeader<KeepRaw<'a, HeaderBody>>>, ) -> PseudoHeader<HeaderBody>

Converts to this type from the input type.
Source§

impl<'b> From<KeepRaw<'b, PlutusData>> for MemoizedPlutusData

Source§

fn from(data: KeepRaw<'b, PlutusData>) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

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

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

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

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

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

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

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

impl OriginalHash<28> for KeepRaw<'_, NativeScript>

Source§

fn original_hash(&self) -> Hash<28>

Source§

impl OriginalHash<32> for KeepRaw<'_, BlockHead>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, EbbHead>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, KeepRaw<'_, PseudoHeader<KeepRaw<'_, HeaderBody>>>>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, KeepRaw<'_, PseudoHeader<KeepRaw<'_, HeaderBody>>>>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, PlutusData>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, PseudoHeader<HeaderBody>>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, PseudoTransactionBody<PseudoTransactionOutput<PseudoPostAlonzoTransactionOutput<Value, PseudoDatumOption<KeepRaw<'_, PlutusData>>, PseudoScript<KeepRaw<'_, NativeScript>>>>>>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, PseudoTransactionBody<PseudoTransactionOutput<PseudoPostAlonzoTransactionOutput<Value, PseudoDatumOption<KeepRaw<'_, PlutusData>>, PseudoScript<KeepRaw<'_, NativeScript>>>>>>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, PseudoTransactionBody<PseudoTransactionOutput<PseudoPostAlonzoTransactionOutput<Value, PseudoDatumOption<PlutusData>, PseudoScript<NativeScript>>>>>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, PseudoTransactionBody<PseudoTransactionOutput<PseudoPostAlonzoTransactionOutput<Value, PseudoDatumOption<PlutusData>, PseudoScript<NativeScript>>>>>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, TransactionBody>

Source§

fn original_hash(&self) -> Hash<32>

Source§

impl OriginalHash<32> for KeepRaw<'_, Tx>

Source§

fn original_hash(&self) -> Hash<32>

Source§

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

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 · Source§

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 for KeepRaw<'b, T>
where T: PartialOrd,

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 · Source§

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

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

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 · Source§

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

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

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 for KeepRaw<'b, T>
where T: Eq,

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> UnsafeUnpin for KeepRaw<'b, T>
where T: UnsafeUnpin,

§

impl<'b, T> UnwindSafe for KeepRaw<'b, T>
where T: 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> CloneToUninit for T
where T: Clone,

Source§

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
Source§

impl<'a, T> Fragment<'a> for T
where T: Encode<()> + Decode<'a, ()>,

Source§

fn encode_fragment(&self) -> Result<Vec<u8>, Box<dyn Error>>

Source§

fn decode_fragment(bytes: &'a [u8]) -> Result<T, Box<dyn Error>>

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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

Uses borrowed data to replace owned data, usually by cloning. Read more
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.