crypto_bigint

Trait 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.

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§

Source§

impl Encoding for Limb

Source§

type Repr = [u8; 8]

Source§

impl Encoding for U64

Source§

type Repr = [u8; 8]

Source§

impl Encoding for U128

Source§

type Repr = [u8; 16]

Source§

impl Encoding for U192

Source§

type Repr = [u8; 24]

Source§

impl Encoding for U256

Source§

type Repr = [u8; 32]

Source§

impl Encoding for U320

Source§

type Repr = [u8; 40]

Source§

impl Encoding for U384

Source§

type Repr = [u8; 48]

Source§

impl Encoding for U448

Source§

type Repr = [u8; 56]

Source§

impl Encoding for U512

Source§

type Repr = [u8; 64]

Source§

impl Encoding for U576

Source§

type Repr = [u8; 72]

Source§

impl Encoding for U640

Source§

type Repr = [u8; 80]

Source§

impl Encoding for U704

Source§

type Repr = [u8; 88]

Source§

impl Encoding for U768

Source§

type Repr = [u8; 96]

Source§

impl Encoding for U832

Source§

type Repr = [u8; 104]

Source§

impl Encoding for U896

Source§

type Repr = [u8; 112]

Source§

impl Encoding for U960

Source§

type Repr = [u8; 120]

Source§

impl Encoding for U1024

Source§

type Repr = [u8; 128]

Source§

impl Encoding for U1280

Source§

type Repr = [u8; 160]

Source§

impl Encoding for U1536

Source§

type Repr = [u8; 192]

Source§

impl Encoding for U1792

Source§

type Repr = [u8; 224]

Source§

impl Encoding for U2048

Source§

type Repr = [u8; 256]

Source§

impl Encoding for U3072

Source§

type Repr = [u8; 384]

Source§

impl Encoding for U3584

Source§

type Repr = [u8; 448]

Source§

impl Encoding for U4096

Source§

type Repr = [u8; 512]

Source§

impl Encoding for U4224

Source§

type Repr = [u8; 528]

Source§

impl Encoding for U4352

Source§

type Repr = [u8; 544]

Source§

impl Encoding for U6144

Source§

type Repr = [u8; 768]

Source§

impl Encoding for U8192

Source§

type Repr = [u8; 1024]

Source§

impl Encoding for U16384

Source§

type Repr = [u8; 2048]

Source§

impl Encoding for U32768

Source§

type Repr = [u8; 4096]