[][src]Struct hcid::HcidEncoding

pub struct HcidEncoding { /* fields omitted */ }

an instance that can encode / decode a particular hcid encoding configuration

Methods

impl HcidEncoding[src]

pub fn new(config: HcidEncodingConfig) -> HcidResult<Self>[src]

create a new HcidEncoding instance from given HcidEncodingConfig

pub fn with_kind(kind: &str) -> HcidResult<Self>[src]

create a new config given a kind token string

Example

extern crate hcid;
let hca0 = hcid::HcidEncoding::with_kind("hca0").unwrap();
let hck0 = hcid::HcidEncoding::with_kind("hck0").unwrap();
let hcs0 = hcid::HcidEncoding::with_kind("hcs0").unwrap();

pub fn encode(&self, data: &[u8]) -> HcidResult<String>[src]

encode a string to base32 with this instance's configuration

pub fn decode(&self, data: &str) -> HcidResult<Vec<u8>>[src]

decode the data from a base32 string with this instance's configuration. Reed-Solomon can correct up to 1/2 its parity size worth of erasures (if no other errors are present).

pub fn is_corrupt(&self, data: &str) -> HcidResult<bool>[src]

a lighter-weight check to determine if a base32 string is corrupt

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]