Struct const_base::Config [−][src]
pub struct Config { /* fields omitted */ }Expand description
For configuring how a string is encoded/decoded.
Config has these values by default:
end_padding = false
Implementations
Constructs a Config from an Encoding
You can use the associated constants for a more
concise way to get a Config
Example
use const_base::{B64CharSet, Config, Encoding, encode}; // The same as `Config::B64` const CFG: Config = Config::new(Encoding::Base64(B64CharSet::Standard)); assert_eq!(encode!("Rust", CFG), b"UnVzdA==")
Determines whether the string has padding at the end.
This is true by default.
For base64 strings, the string is padded to be a multiple of 4 long, with =.
Example
use const_base::{B64CharSet, Config, Encoding, encode}; assert_eq!(encode!("Rust", Config::B64), b"UnVzdA=="); assert_eq!(encode!("Rust", Config::B64.end_padding(true)), b"UnVzdA=="); assert_eq!(encode!("Rust", Config::B64.end_padding(false)), b"UnVzdA");