BytesRepresentable

Trait BytesRepresentable 

Source
pub trait BytesRepresentable<E = GeneralError>: AsRef<[u8]> + for<'a> TryFrom<&'a [u8], Error = E> {
    const SIZE: usize;

    // Provided method
    fn into_boxed(self) -> Box<[u8]> { ... }
}
Expand description

Represents a type already internally represented by a fixed size byte array, and therefore requires no memory allocation to represent the type in binary encoding.

This is a strict subset of BytesEncodable, see its documentation for details.

Required Associated Constants§

Source

const SIZE: usize

Size of the encoded byte array.

Provided Methods§

Source

fn into_boxed(self) -> Box<[u8]>

Convenience function to copy this type’s binary representation into a Box.

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 BytesRepresentable for HoprSenderId

Source§

const SIZE: usize = 18usize

Source§

impl BytesRepresentable for OffchainSignature

Source§

const SIZE: usize = 64usize

Size of the EdDSA signature using Ed25519.

Source§

impl BytesRepresentable for HalfKey

Source§

const SIZE: usize = 32usize

Size of the secp256k1 secret scalar representing the HalfKey.

Source§

impl BytesRepresentable for OffchainPublicKey

Source§

const SIZE: usize = 32usize

Size of the public key (compressed Edwards Y coordinate)

Source§

impl BytesRepresentable for PublicKey

Source§

const SIZE: usize = 33usize

Source§

impl BytesRepresentable for Response

Source§

const SIZE: usize = 32usize

Size of the PoR challenge response.

Source§

impl BytesRepresentable for SimplePseudonym

Source§

const SIZE: usize = 10usize

Source§

impl<E> BytesRepresentable for ChainSignature<E>

Source§

const SIZE: usize = 64usize

Source§

impl<H> BytesRepresentable for HashBase<H>

Source§

const SIZE: usize = 32usize

The size of the digest is 32 bytes.

Source§

impl<S, H, const P: usize> BytesRepresentable for MetaPacket<S, H, P>

Source§

impl<const N: usize> BytesRepresentable<TryFromSliceError> for [u8; N]

Source§

const SIZE: usize = N

Implementors§