Macro b64_decode

Source
macro_rules! b64_decode {
    ($data:expr) => { ... };
    (STANDARD: $($tt:tt)+) => { ... };
    (STANDARD_NO_PAD: $($tt:tt)+) => { ... };
    (URL_SAFE: $($tt:tt)+) => { ... };
    (URL_SAFE_NO_PAD: $($tt:tt)+) => { ... };
    ($padding:path, $data:expr) => { ... };
    ($padding:path, $data:expr, $buf:expr) => { ... };
}
Expand description

Decode given base64 string to bytes.

ยงExample:

use macro_toolset::{b64_decode, base64::engine::general_purpose};
// Default padding: STANDARD, returns `Vec<u8>`.
b64_decode!("aGVsbG8gd29ybGQ=")  
// Available padding: STANDARD / STANDARD_NO_PAD / URL_SAFE / URL_SAFE_NO_PAD.
// No need to import!
b64_decode!(URL_SAFE_NO_PAD: "aGVsbG8gd29ybGQ")
// To given `Vec<u8>`
b64_decode!(URL_SAFE_NO_PAD: "aGVsbG8gd29ybGQ", &mut example);
// Though not recommended, we support the full path as well.
b64_decode!(general_purpose::URL_SAFE_NO_PAD, "aGVsbG8gd29ybGQ")