hopr_lib

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 that is 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 Challenge

Source§

const SIZE: usize = 33usize

Source§

impl BytesRepresentable for CompressedPublicKey

Source§

const SIZE: usize = 33usize

Source§

impl BytesRepresentable for CurvePoint

Source§

const SIZE: usize = 33usize

Source§

impl BytesRepresentable for HalfKey

Source§

const SIZE: usize = 32usize

Size of the secp256k1 secret scalar representing the half key.

Source§

impl BytesRepresentable for Hash

Source§

const SIZE: usize = 32usize

Size of the digest, which is EthDigest::SIZE.

Source§

impl BytesRepresentable for OffchainPublicKey

Source§

const SIZE: usize = 32usize

Size of the public key (compressed Edwards Y coordinate)

Source§

impl BytesRepresentable for OffchainSignature

Source§

const SIZE: usize = 64usize

Size of the EdDSA signature using Ed25519.

Source§

impl BytesRepresentable for Response

Source§

const SIZE: usize = 32usize

Fixed size of the PoR challenge response.

Source§

impl BytesRepresentable for Signature

Source§

const SIZE: usize = 64usize

Source§

impl<S> BytesRepresentable for MetaPacket<S>
where S: SphinxSuite,

Implementors§