Trait IntegerType

Source
pub trait IntegerType:
    Sized
    + Clone
    + Debug
    + TryFrom<i64>
    + TryFrom<i128>
    + TryInto<i128>
    + Into<Integer>
    + Num
    + CheckedAdd {
    const WIDTH: u32;

    // Required methods
    fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>;
    fn try_from_signed_bytes(
        input: &[u8],
        codec: Codec,
    ) -> Result<Self, DecodeError>;
    fn try_from_unsigned_bytes(
        input: &[u8],
        codec: Codec,
    ) -> Result<Self, DecodeError>;
}

Required Associated Constants§

Required Methods§

Source

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

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.

Implementations on Foreign Types§

Source§

impl IntegerType for i8

Source§

const WIDTH: u32 = 8u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for i16

Source§

const WIDTH: u32 = 16u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for i32

Source§

const WIDTH: u32 = 32u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for i64

Source§

const WIDTH: u32 = 64u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for i128

Source§

const WIDTH: u32 = 128u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for isize

Source§

const WIDTH: u32 = 64u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for u8

Source§

const WIDTH: u32 = 8u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for u16

Source§

const WIDTH: u32 = 16u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for u32

Source§

const WIDTH: u32 = 32u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for u64

Source§

const WIDTH: u32 = 64u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for u128

Source§

const WIDTH: u32 = 128u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

impl IntegerType for usize

Source§

const WIDTH: u32 = 64u32

Source§

fn try_from_bytes(input: &[u8], codec: Codec) -> Result<Self, DecodeError>

Source§

fn try_from_signed_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Source§

fn try_from_unsigned_bytes( input: &[u8], codec: Codec, ) -> Result<Self, DecodeError>

Implementors§

Source§

impl IntegerType for Integer

Source§

const WIDTH: u32 = 4_294_967_295u32