Trait Encoding

Source
pub trait Encoding: Sized {
    type Repr: AsRef<[u8]> + AsMut<[u8]> + Copy + Clone + Sized + for<'a> TryFrom<&'a [u8], Error = TryFromSliceError>;

    // 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 + for<'a> TryFrom<&'a [u8], Error = TryFromSliceError>

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; 4]

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 U224

Source§

type Repr = [u8; 28]

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 U544

Source§

type Repr = [u8; 68]

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 U1088

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 136]

Source§

impl Encoding for U1152

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 144]

Source§

impl Encoding for U1216

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 152]

Source§

impl Encoding for U1280

Source§

type Repr = [u8; 160]

Source§

impl Encoding for U1344

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 168]

Source§

impl Encoding for U1408

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 176]

Source§

impl Encoding for U1472

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 184]

Source§

impl Encoding for U1536

Source§

type Repr = [u8; 192]

Source§

impl Encoding for U1600

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 200]

Source§

impl Encoding for U1664

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 208]

Source§

impl Encoding for U1728

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 216]

Source§

impl Encoding for U1792

Source§

type Repr = [u8; 224]

Source§

impl Encoding for U1856

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 232]

Source§

impl Encoding for U1920

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 240]

Source§

impl Encoding for U1984

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 248]

Source§

impl Encoding for U2048

Source§

type Repr = [u8; 256]

Source§

impl Encoding for U2112

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 264]

Source§

impl Encoding for U2176

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 272]

Source§

impl Encoding for U2240

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 280]

Source§

impl Encoding for U2304

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 288]

Source§

impl Encoding for U2368

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 296]

Source§

impl Encoding for U2432

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 304]

Source§

impl Encoding for U2496

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 312]

Source§

impl Encoding for U2560

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 320]

Source§

impl Encoding for U2624

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 328]

Source§

impl Encoding for U2688

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 336]

Source§

impl Encoding for U2752

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 344]

Source§

impl Encoding for U2816

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 352]

Source§

impl Encoding for U2880

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 360]

Source§

impl Encoding for U2944

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 368]

Source§

impl Encoding for U3008

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 376]

Source§

impl Encoding for U3072

Source§

type Repr = [u8; 384]

Source§

impl Encoding for U3136

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 392]

Source§

impl Encoding for U3200

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 400]

Source§

impl Encoding for U3264

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 408]

Source§

impl Encoding for U3328

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 416]

Source§

impl Encoding for U3392

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 424]

Source§

impl Encoding for U3456

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 432]

Source§

impl Encoding for U3520

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 440]

Source§

impl Encoding for U3584

Source§

type Repr = [u8; 448]

Source§

impl Encoding for U3648

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 456]

Source§

impl Encoding for U3712

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 464]

Source§

impl Encoding for U3776

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 472]

Source§

impl Encoding for U3840

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 480]

Source§

impl Encoding for U3904

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 488]

Source§

impl Encoding for U3968

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 496]

Source§

impl Encoding for U4032

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 504]

Source§

impl Encoding for U4096

Source§

type Repr = [u8; 512]

Source§

impl Encoding for U4160

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 520]

Source§

impl Encoding for U4224

Source§

type Repr = [u8; 528]

Source§

impl Encoding for U4288

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 536]

Source§

impl Encoding for U4352

Source§

type Repr = [u8; 544]

Source§

impl Encoding for U4416

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 552]

Source§

impl Encoding for U4480

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 560]

Source§

impl Encoding for U4544

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 568]

Source§

impl Encoding for U4608

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 576]

Source§

impl Encoding for U4672

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 584]

Source§

impl Encoding for U4736

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 592]

Source§

impl Encoding for U4800

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 600]

Source§

impl Encoding for U4864

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 608]

Source§

impl Encoding for U4928

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 616]

Source§

impl Encoding for U4992

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 624]

Source§

impl Encoding for U5056

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 632]

Source§

impl Encoding for U5120

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 640]

Source§

impl Encoding for U5184

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 648]

Source§

impl Encoding for U5248

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 656]

Source§

impl Encoding for U5312

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 664]

Source§

impl Encoding for U5376

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 672]

Source§

impl Encoding for U5440

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 680]

Source§

impl Encoding for U5504

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 688]

Source§

impl Encoding for U5568

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 696]

Source§

impl Encoding for U5632

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 704]

Source§

impl Encoding for U5696

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 712]

Source§

impl Encoding for U5760

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 720]

Source§

impl Encoding for U5824

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 728]

Source§

impl Encoding for U5888

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 736]

Source§

impl Encoding for U5952

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 744]

Source§

impl Encoding for U6016

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 752]

Source§

impl Encoding for U6080

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 760]

Source§

impl Encoding for U6144

Source§

type Repr = [u8; 768]

Source§

impl Encoding for U6208

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 776]

Source§

impl Encoding for U6272

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 784]

Source§

impl Encoding for U6336

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 792]

Source§

impl Encoding for U6400

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 800]

Source§

impl Encoding for U6464

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 808]

Source§

impl Encoding for U6528

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 816]

Source§

impl Encoding for U6592

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 824]

Source§

impl Encoding for U6656

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 832]

Source§

impl Encoding for U6720

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 840]

Source§

impl Encoding for U6784

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 848]

Source§

impl Encoding for U6848

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 856]

Source§

impl Encoding for U6912

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 864]

Source§

impl Encoding for U6976

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 872]

Source§

impl Encoding for U7040

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 880]

Source§

impl Encoding for U7104

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 888]

Source§

impl Encoding for U7168

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 896]

Source§

impl Encoding for U7232

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 904]

Source§

impl Encoding for U7296

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 912]

Source§

impl Encoding for U7360

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 920]

Source§

impl Encoding for U7424

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 928]

Source§

impl Encoding for U7488

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 936]

Source§

impl Encoding for U7552

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 944]

Source§

impl Encoding for U7616

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 952]

Source§

impl Encoding for U7680

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 960]

Source§

impl Encoding for U7744

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 968]

Source§

impl Encoding for U7808

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 976]

Source§

impl Encoding for U7872

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 984]

Source§

impl Encoding for U7936

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 992]

Source§

impl Encoding for U8000

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 1000]

Source§

impl Encoding for U8064

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 1008]

Source§

impl Encoding for U8128

Available on crate feature extra-sizes only.
Source§

type Repr = [u8; 1016]

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]