From b29ab0196d4996b11a446fe487f34d186656d4f8 Mon Sep 17 00:00:00 2001 From: Marshall Pierce <575695+marshallpierce@users.noreply.github.com> Date: Sun, 1 Jan 2023 11:56:06 -0700 Subject: [PATCH] Add `Engine` in `prelude` --- RELEASE-NOTES.md | 1 + src/lib.rs | 2 +- src/prelude.rs | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 06aaaaf..4fcadda 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -40,6 +40,7 @@ precisely, see the following table. # 0.21.0-rc.1 - Restore the ability to decode into a slice of precisely the correct length with `Engine.decode_slice_unchecked`. +- Add `Engine` as a `pub use` in `prelude`. # 0.21.0-beta.2 diff --git a/src/lib.rs b/src/lib.rs index deff840..cc9d628 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ //! 1. Perhaps one of the preconfigured engines in [engine::general_purpose] will suit, e.g. //! [engine::general_purpose::STANDARD_NO_PAD]. //! - These are re-exported in [prelude] with a `BASE64_` prefix for those who prefer to -//! `use ...::prelude::*` or equivalent, e.g. [prelude::BASE64_STANDARD_NO_PAD] +//! `use base64::prelude::*` or equivalent, e.g. [prelude::BASE64_STANDARD_NO_PAD] //! 1. If not, choose which alphabet you want. Most usage will want [alphabet::STANDARD] or [alphabet::URL_SAFE]. //! 1. Choose which [Engine] implementation you want. For the moment there is only one: [engine::GeneralPurpose]. //! 1. Configure the engine appropriately using the engine's `Config` type. diff --git a/src/prelude.rs b/src/prelude.rs index a88785e..fbeb5ba 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -6,10 +6,13 @@ //! # Examples //! //! ``` -//! use base64::{Engine as _, prelude::BASE64_STANDARD_NO_PAD}; +//! use base64::prelude::{Engine as _, BASE64_STANDARD_NO_PAD}; //! //! assert_eq!("c29tZSBieXRlcw", &BASE64_STANDARD_NO_PAD.encode(b"some bytes")); //! ``` + +pub use crate::engine::Engine; + pub use crate::engine::general_purpose::STANDARD as BASE64_STANDARD; pub use crate::engine::general_purpose::STANDARD_NO_PAD as BASE64_STANDARD_NO_PAD; pub use crate::engine::general_purpose::URL_SAFE as BASE64_URL_SAFE;