Trait bilrost::WithCanonicity

source ·
pub trait WithCanonicity {
    type Value;
    type WithoutCanonicity;

    // Required methods
    fn canonical(self) -> Result<Self::Value, DecodeErrorKind>;
    fn canonical_with_extensions(self) -> Result<Self::Value, DecodeErrorKind>;
    fn value(self) -> Self::WithoutCanonicity;
}
Expand description

Trait for values and results bearing canonicity information (represented by the Canonicity enum).

Required Associated Types§

source

type Value

The type of the value without any canonicity information.

source

type WithoutCanonicity

Required Methods§

source

fn canonical(self) -> Result<Self::Value, DecodeErrorKind>

Get the value if it is fully canonical, otherwise returning an error.

source

fn canonical_with_extensions(self) -> Result<Self::Value, DecodeErrorKind>

Get the value as long as its known fields are canonical, otherwise returning an error.

source

fn value(self) -> Self::WithoutCanonicity

Discards the canonicity.

If this method is always being used and canonicity information is always discarded, distinguished decoding may not be needed, and the program can be made more efficient by simply using expedient decoding mode.

Implementations on Foreign Types§

source§

impl<'a, T> WithCanonicity for &'a (T, Canonicity)

source§

impl<T> WithCanonicity for (T, Canonicity)

source§

impl<T, E> WithCanonicity for Result<T, E>

Implementors§