Skip to main content

Encoding

Trait Encoding 

pub trait Encoding: Sized {
    type Repr: AsRef<[u8]> + AsMut<[u8]> + Copy + Clone;

    // Required methods
    fn from_be_bytes(bytes: Self::Repr) -> Self;
    fn from_le_bytes(bytes: Self::Repr) -> Self;
    fn to_be_bytes(&self) -> Self::Repr;
    fn to_le_bytes(&self) -> Self::Repr;
}
Expand description

Encoding support.

Required Associated Types§

type Repr: AsRef<[u8]> + AsMut<[u8]> + Copy + Clone

Byte array representation.

Required Methods§

fn from_be_bytes(bytes: Self::Repr) -> Self

Decode from big endian bytes.

fn from_le_bytes(bytes: Self::Repr) -> Self

Decode from little endian bytes.

fn to_be_bytes(&self) -> Self::Repr

Encode to big endian bytes.

fn to_le_bytes(&self) -> Self::Repr

Encode to little endian bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl Encoding for Limb

§

type Repr = [u8; 8]

§

impl Encoding for Uint<crypto_bigint::::uint::U64::{constant#0}>

§

type Repr = [u8; 8]

§

impl Encoding for Uint<crypto_bigint::::uint::U128::{constant#0}>

§

type Repr = [u8; 16]

§

impl Encoding for Uint<crypto_bigint::::uint::U192::{constant#0}>

§

type Repr = [u8; 24]

§

impl Encoding for Uint<crypto_bigint::::uint::U256::{constant#0}>

§

type Repr = [u8; 32]

§

impl Encoding for Uint<crypto_bigint::::uint::U320::{constant#0}>

§

type Repr = [u8; 40]

§

impl Encoding for Uint<crypto_bigint::::uint::U384::{constant#0}>

§

type Repr = [u8; 48]

§

impl Encoding for Uint<crypto_bigint::::uint::U448::{constant#0}>

§

type Repr = [u8; 56]

§

impl Encoding for Uint<crypto_bigint::::uint::U512::{constant#0}>

§

type Repr = [u8; 64]

§

impl Encoding for Uint<crypto_bigint::::uint::U576::{constant#0}>

§

type Repr = [u8; 72]

§

impl Encoding for Uint<crypto_bigint::::uint::U640::{constant#0}>

§

type Repr = [u8; 80]

§

impl Encoding for Uint<crypto_bigint::::uint::U704::{constant#0}>

§

type Repr = [u8; 88]

§

impl Encoding for Uint<crypto_bigint::::uint::U768::{constant#0}>

§

type Repr = [u8; 96]

§

impl Encoding for Uint<crypto_bigint::::uint::U832::{constant#0}>

§

type Repr = [u8; 104]

§

impl Encoding for Uint<crypto_bigint::::uint::U896::{constant#0}>

§

type Repr = [u8; 112]

§

impl Encoding for Uint<crypto_bigint::::uint::U960::{constant#0}>

§

type Repr = [u8; 120]

§

impl Encoding for Uint<crypto_bigint::::uint::U1024::{constant#0}>

§

type Repr = [u8; 128]

§

impl Encoding for Uint<crypto_bigint::::uint::U1280::{constant#0}>

§

type Repr = [u8; 160]

§

impl Encoding for Uint<crypto_bigint::::uint::U1536::{constant#0}>

§

type Repr = [u8; 192]

§

impl Encoding for Uint<crypto_bigint::::uint::U1792::{constant#0}>

§

type Repr = [u8; 224]

§

impl Encoding for Uint<crypto_bigint::::uint::U2048::{constant#0}>

§

type Repr = [u8; 256]

§

impl Encoding for Uint<crypto_bigint::::uint::U3072::{constant#0}>

§

type Repr = [u8; 384]

§

impl Encoding for Uint<crypto_bigint::::uint::U3584::{constant#0}>

§

type Repr = [u8; 448]

§

impl Encoding for Uint<crypto_bigint::::uint::U4096::{constant#0}>

§

type Repr = [u8; 512]

§

impl Encoding for Uint<crypto_bigint::::uint::U4224::{constant#0}>

§

type Repr = [u8; 528]

§

impl Encoding for Uint<crypto_bigint::::uint::U4352::{constant#0}>

§

type Repr = [u8; 544]

§

impl Encoding for Uint<crypto_bigint::::uint::U6144::{constant#0}>

§

type Repr = [u8; 768]

§

impl Encoding for Uint<crypto_bigint::::uint::U8192::{constant#0}>

§

type Repr = [u8; 1024]

§

impl Encoding for Uint<crypto_bigint::::uint::U16384::{constant#0}>

§

type Repr = [u8; 2048]

§

impl Encoding for Uint<crypto_bigint::::uint::U32768::{constant#0}>

§

type Repr = [u8; 4096]