Skip to main content

base64/
prelude.rs

1//! Preconfigured engines for common use cases.
2//!
3//! These are re-exports of `const` engines in [crate::engine::general_purpose], renamed with a `BASE64_`
4//! prefix for those who prefer to `use` the entire path to a name.
5//!
6//! All of these engine presets enforce no trailing bits when decoding.
7//!
8//! # Examples
9//!
10#![cfg_attr(feature = "alloc", doc = "```")]
11#![cfg_attr(not(feature = "alloc"), doc = "```ignore")]
12//! use base64::prelude::{Engine as _, BASE64_STANDARD_NO_PAD};
13//!
14//! assert_eq!("c29tZSBieXRlcw", &BASE64_STANDARD_NO_PAD.encode(b"some bytes"));
15//! ```
16
17pub use crate::engine::Engine;
18
19pub use crate::engine::general_purpose::STANDARD as BASE64_STANDARD;
20pub use crate::engine::general_purpose::STANDARD_NO_PAD as BASE64_STANDARD_NO_PAD;
21pub use crate::engine::general_purpose::URL_SAFE as BASE64_URL_SAFE;
22pub use crate::engine::general_purpose::URL_SAFE_NO_PAD as BASE64_URL_SAFE_NO_PAD;