Converter

Trait Converter 

Source
pub trait Converter {
    // Required methods
    fn to_vec(n: &Self) -> Vec<u8> ;
    fn to_hex(&self) -> String;
    fn from_hex(n: &str) -> Result<BigInt, HexError>;
    fn from_bytes(bytes: &[u8]) -> Self;
    fn to_bytes(&self) -> Vec<u8> ;
}
Expand description

Convert BigInt to and from various formats

Required Methods§

Source

fn to_vec(n: &Self) -> Vec<u8>

Convert BigInt to Vec<u8>

Source

fn to_hex(&self) -> String

Convert BigInt to a hex string

Source

fn from_hex(n: &str) -> Result<BigInt, HexError>

Create a BigInt from a hex String

Source

fn from_bytes(bytes: &[u8]) -> Self

Create a BigInt from bytes

Source

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

Convert a BigInt to bytes

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 Converter for Mpz

Source§

fn to_vec(value: &Mpz) -> Vec<u8>

Source§

fn to_hex(&self) -> String

Source§

fn from_hex(value: &str) -> Result<Mpz, HexError>

Source§

fn from_bytes(bytes: &[u8]) -> Mpz

Source§

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

Implementors§