Trait gclient::ext::sp_core::ByteArray

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§

const LEN: usize

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

Provided Methods§

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

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

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

Return a Vec<u8> filled with raw data.

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

Return a slice filled with raw data.

Object Safety§

This trait is not object safe.

Implementors§

§

impl ByteArray for gclient::ext::sp_runtime::app_crypto::ecdsa::AppPublic

§

const LEN: usize = 33usize

§

impl ByteArray for gclient::ext::sp_runtime::app_crypto::ecdsa::AppSignature

§

const LEN: usize = 65usize

§

impl ByteArray for gclient::ext::sp_runtime::app_crypto::ed25519::AppPublic

§

const LEN: usize = 32usize

§

impl ByteArray for gclient::ext::sp_runtime::app_crypto::ed25519::AppSignature

§

const LEN: usize = 64usize

§

impl ByteArray for gclient::ext::sp_runtime::app_crypto::sr25519::AppPublic

§

const LEN: usize = 32usize

§

impl ByteArray for gclient::ext::sp_runtime::app_crypto::sr25519::AppSignature

§

const LEN: usize = 64usize

§

impl ByteArray for AccountId32

§

const LEN: usize = 32usize

§

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

§

const LEN: usize = N