[][src]Trait signatory::encoding::Encode

pub trait Encode: Sized {
    fn encode<E: Encoding>(&self, encoding: &E) -> Vec<u8>;

    fn encode_to_string<E: Encoding>(
        &self,
        encoding: &E
    ) -> Result<String, Error> { ... }
fn encode_to_writer<W, E>(
        &self,
        writer: &mut W,
        encoding: &E
    ) -> Result<usize, Error>
    where
        W: Write,
        E: Encoding
, { ... }
fn encode_to_file<P, E>(&self, path: P, encoding: &E) -> Result<File, Error>
    where
        P: AsRef<Path>,
        E: Encoding
, { ... } }

Serialize keys/signatures with the given encoding (e.g. hex, Base64). Uses constant time encoder/decoder implementations.

Required methods

fn encode<E: Encoding>(&self, encoding: &E) -> Vec<u8>

Encode self to a Vec<u8> using the provided Encoding, returning the encoded value or a Error.

Loading content...

Provided methods

fn encode_to_string<E: Encoding>(&self, encoding: &E) -> Result<String, Error>

Encode self to a String using the provided Encoding, returning the encoded value or a Error.

fn encode_to_writer<W, E>(
    &self,
    writer: &mut W,
    encoding: &E
) -> Result<usize, Error> where
    W: Write,
    E: Encoding

Encode self with the given Encoding, writing the result to the supplied io::Write type, returning the number of bytes written or a Error.

fn encode_to_file<P, E>(&self, path: P, encoding: &E) -> Result<File, Error> where
    P: AsRef<Path>,
    E: Encoding

Encode self and write it to a file at the given path, returning the resulting File or a Error.

If the file does not exist, it will be created with a mode of FILE_MODE (i.e. 600). If the file does exist, it will be erased and replaced.

Loading content...

Implementors

impl Encode for PublicKey[src]

fn encode<E: Encoding>(&self, encoding: &E) -> Vec<u8>[src]

Encode an Ed25519 seed with the given encoding (e.g. hex, Base64)

impl Encode for Seed[src]

fn encode<E: Encoding>(&self, encoding: &E) -> Vec<u8>[src]

Encode an Ed25519 seed with the given encoding (e.g. hex, Base64)

Loading content...