Trait TonCellNum

Source
pub trait TonCellNum:
    Display
    + Sized
    + Clone {
    type Primitive: Zero + Integer;
    type UnsignedPrimitive: Integer;

    const SIGNED: bool;
    const IS_PRIMITIVE: bool = false;

    // Required methods
    fn tcn_from_bytes(bytes: &[u8]) -> Self;
    fn tcn_to_bytes(&self) -> Vec<u8> ;
    fn tcn_from_primitive(value: Self::Primitive) -> Self;
    fn tcn_to_unsigned_primitive(&self) -> Option<Self::UnsignedPrimitive>;
    fn tcn_is_zero(&self) -> bool;
    fn tcn_min_bits_len(&self) -> usize;
    fn tcn_shr(&self, bits: u32) -> Self;
}
Expand description

Allows generic read/write operation for any numeric type

Required Associated Constants§

Provided Associated Constants§

Source

const IS_PRIMITIVE: bool = false

Required Associated Types§

Required Methods§

Source

fn tcn_from_bytes(bytes: &[u8]) -> Self

Source

fn tcn_to_bytes(&self) -> Vec<u8>

Source

fn tcn_from_primitive(value: Self::Primitive) -> Self

Source

fn tcn_to_unsigned_primitive(&self) -> Option<Self::UnsignedPrimitive>

Source

fn tcn_is_zero(&self) -> bool

Source

fn tcn_min_bits_len(&self) -> usize

Source

fn tcn_shr(&self, bits: u32) -> Self

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 TonCellNum for i8

Source§

impl TonCellNum for i16

Source§

impl TonCellNum for i32

Source§

impl TonCellNum for i64

Source§

impl TonCellNum for i128

Source§

impl TonCellNum for u8

Source§

impl TonCellNum for u16

Source§

impl TonCellNum for u32

Source§

impl TonCellNum for u64

Source§

impl TonCellNum for u128

Source§

impl TonCellNum for usize

Source§

impl TonCellNum for BigInt

Source§

impl TonCellNum for BigUint

Implementors§