Trait basenc::Encode
[−]
[src]
pub trait Encode<I: Iterator<Item = u8>, R: Encoder<I>> { fn encode(self, encoding: R) -> R::Encoder; }
Byte iterator adapter to an encoder.
Adapts any Iterator<Item = u8>
into an iterator over the encoded chars.
Beware of code bloat! The entire decode logic may get inlined at the invocation site.
Examples
use basenc::Encode; assert!( "hello".bytes() .encode(basenc::UpperHex) .eq("68656C6C6F".chars()) ); assert!( b"\xadapters\xff"[..].iter().cloned() .encode(basenc::Base64Url) .eq("rWFwdGVyc_8".chars()) ); assert!( "STRingS".bytes() .encode(basenc::LowerHex) .eq("535452696e6753".chars()) );