Trait basenc::Encoding
[−]
[src]
pub trait Encoding { fn alphabet(self) -> &'static str; fn encode<B: EncodeBuf>(self, bytes: &[u8], buffer: B) -> B::Output; fn decode<B: DecodeBuf>(
self,
string: &str,
buffer: B
) -> Result<B::Output, Error>; }
Data encoding.
Use the free-standing functions to avoid having to drag in this trait.
Required Methods
fn alphabet(self) -> &'static str
Returns the encoding's alphabet.
Examples
use basenc::{Encoding}; assert_eq!( basenc::LowerHex.alphabet(), "0123456789abcdef" );
fn encode<B: EncodeBuf>(self, bytes: &[u8], buffer: B) -> B::Output
Directly encode into an encode buffer.
Use encode
for convenience.
fn decode<B: DecodeBuf>(
self,
string: &str,
buffer: B
) -> Result<B::Output, Error>
self,
string: &str,
buffer: B
) -> Result<B::Output, Error>
Directly decode into a decode buffer.
Use decode
for convenience.