Trait crypto_bigint::prelude::Encoding

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

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

source

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

Byte array representation.

Required Methods§

source

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

Decode from big endian bytes.

source

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

Decode from little endian bytes.

source

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

Encode to big endian bytes.

source

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

Encode to little endian bytes.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Encoding for Limb

§

type Repr = [u8; 8]

source§

impl Encoding for U64

§

type Repr = [u8; 8]

source§

impl Encoding for U128

§

type Repr = [u8; 16]

source§

impl Encoding for U192

§

type Repr = [u8; 24]

source§

impl Encoding for U256

§

type Repr = [u8; 32]

source§

impl Encoding for U320

§

type Repr = [u8; 40]

source§

impl Encoding for U384

§

type Repr = [u8; 48]

source§

impl Encoding for U448

§

type Repr = [u8; 56]

source§

impl Encoding for U512

§

type Repr = [u8; 64]

source§

impl Encoding for U576

§

type Repr = [u8; 72]

source§

impl Encoding for U640

§

type Repr = [u8; 80]

source§

impl Encoding for U704

§

type Repr = [u8; 88]

source§

impl Encoding for U768

§

type Repr = [u8; 96]

source§

impl Encoding for U832

§

type Repr = [u8; 104]

source§

impl Encoding for U896

§

type Repr = [u8; 112]

source§

impl Encoding for U960

§

type Repr = [u8; 120]

source§

impl Encoding for U1024

§

type Repr = [u8; 128]

source§

impl Encoding for U1280

§

type Repr = [u8; 160]

source§

impl Encoding for U1536

§

type Repr = [u8; 192]

source§

impl Encoding for U1792

§

type Repr = [u8; 224]

source§

impl Encoding for U2048

§

type Repr = [u8; 256]

source§

impl Encoding for U3072

§

type Repr = [u8; 384]

source§

impl Encoding for U3584

§

type Repr = [u8; 448]

source§

impl Encoding for U4096

§

type Repr = [u8; 512]

source§

impl Encoding for U4224

§

type Repr = [u8; 528]

source§

impl Encoding for U4352

§

type Repr = [u8; 544]

source§

impl Encoding for U6144

§

type Repr = [u8; 768]

source§

impl Encoding for U8192

§

type Repr = [u8; 1024]

source§

impl Encoding for U16384

§

type Repr = [u8; 2048]

source§

impl Encoding for U32768

§

type Repr = [u8; 4096]