Skip to main content

TypedCurve

Trait TypedCurve 

Source
pub trait TypedCurve {
    const CURVE_TYPE: &str;

    // Provided methods
    fn to_base58(bytes: impl AsRef<[u8]>) -> String { ... }
    fn parse_base58<const N: usize>(
        s: impl AsRef<str>,
    ) -> Result<[u8; N], ParseCurveError> { ... }
}
Expand description

Helper trait to encode/decode bytes as <CURVE>:<base58>

Required Associated Constants§

Source

const CURVE_TYPE: &str

Used as prefix: <CURVE>:...

Provided Methods§

Source

fn to_base58(bytes: impl AsRef<[u8]>) -> String

Encodes bytes to string as <CURVE>:<base58>

Source

fn parse_base58<const N: usize>( s: impl AsRef<str>, ) -> Result<[u8; N], ParseCurveError>

Decodes bytes from string as <CURVE>:<base58>

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 TypedCurve for Ed25519

Source§

const CURVE_TYPE: &str = "ed25519"

Source§

impl TypedCurve for P256

Source§

const CURVE_TYPE: &str = "p256"

Source§

impl TypedCurve for Secp256k1

Source§

const CURVE_TYPE: &str = "secp256k1"