Skip to main content

ByteArray

Trait ByteArray 

Source
pub trait ByteArray:
    AsRef<[u8]>
    + AsMut<[u8]>
    + for<'a> TryFrom<&'a [u8], Error = ()> {
    const LEN: usize;

    // Provided methods
    fn from_slice(data: &[u8]) -> Result<Self, ()> { ... }
    fn to_raw_vec(&self) -> Vec<u8>  { ... }
    fn as_slice(&self) -> &[u8]  { ... }
}
Expand description

Trait used for types that are really just a fixed-length array.

Required Associated Constants§

Source

const LEN: usize

The “length” of the values of this type, which is always the same.

Provided Methods§

Source

fn from_slice(data: &[u8]) -> Result<Self, ()>

A new instance from the given slice that should be Self::LEN bytes long.

Source

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

Return a Vec<u8> filled with raw data.

Source

fn as_slice(&self) -> &[u8]

Return a slice filled with raw data.

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 ByteArray for AccountId32

Source§

const LEN: usize = 32

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::ecdsa::AppProofOfPossession

Source§

const LEN: usize = super::ProofOfPossession::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::ecdsa::AppPublic

Source§

const LEN: usize = super::Public::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::ecdsa::AppSignature

Source§

const LEN: usize = super::Signature::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::ed25519::AppProofOfPossession

Source§

const LEN: usize = super::ProofOfPossession::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::ed25519::AppPublic

Source§

const LEN: usize = super::Public::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::ed25519::AppSignature

Source§

const LEN: usize = super::Signature::LEN

Source§

impl ByteArray for subsoil::consensus::beefy::ecdsa_crypto::ProofOfPossession

Source§

const LEN: usize = ecdsa::ProofOfPossession::LEN

Source§

impl ByteArray for subsoil::consensus::beefy::ecdsa_crypto::Public

Source§

const LEN: usize = ecdsa::Public::LEN

Source§

impl ByteArray for subsoil::consensus::beefy::ecdsa_crypto::Signature

Source§

const LEN: usize = ecdsa::Signature::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::sr25519::AppProofOfPossession

Source§

const LEN: usize = super::ProofOfPossession::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::sr25519::AppPublic

Source§

const LEN: usize = super::Public::LEN

Source§

impl ByteArray for topsoil_core::runtime::app_crypto::sr25519::AppSignature

Source§

const LEN: usize = super::Signature::LEN

Source§

impl<const N: usize, T> ByteArray for CryptoBytes<N, T>

Source§

const LEN: usize = N