zink_codegen::utils

Trait Bytes32

Source
pub trait Bytes32: Sized {
    // Required method
    fn to_bytes32(&self) -> [u8; 32];

    // Provided method
    fn to_vec(&self) -> Vec<u8> { ... }
}
Expand description

Trait for converting type to bytes32.

Required Methods§

Source

fn to_bytes32(&self) -> [u8; 32]

Convert type to the lowest significant bytes 32.

Provided Methods§

Source

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

Convert type to vec of 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.

Implementations on Foreign Types§

Source§

impl Bytes32 for &str

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for &[u8]

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for bool

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

impl Bytes32 for i8

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for i16

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for i32

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for i64

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for i128

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for u8

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for u16

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for u32

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for u64

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for u128

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for ()

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for usize

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for Vec<u8>

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Source§

impl Bytes32 for [u8; 20]

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

impl Bytes32 for [u8; 32]

Source§

fn to_bytes32(&self) -> [u8; 32]

Source§

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

Implementors§