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§

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

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.

Implementors§

§

impl Encoding for Limb

§

type Repr = [u8; 4]

§

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::U224::{constant#0}>

§

type Repr = [u8; 28]

§

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::U544::{constant#0}>

§

type Repr = [u8; 68]

§

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::U768::{constant#0}>

§

type Repr = [u8; 96]

§

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

§

type Repr = [u8; 112]

§

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::U6144::{constant#0}>

§

type Repr = [u8; 768]

§

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

§

type Repr = [u8; 1024]