pub fn urlsafe_base64_encode(bytes: &[u8]) -> StringExpand description
Base64-encode bytes with the URL-safe alphabet and the =
padding stripped, so
the result drops into a URL path or query value with no escaping.
Used for the uidb64 part of /reset/<uidb64>/<token>/.
ⓘ
use rustango::url_codec::urlsafe_base64_encode;
assert_eq!(urlsafe_base64_encode(b"foo"), "Zm9v");
assert_eq!(urlsafe_base64_encode(b""), "");
// Encodes characters that would need `%`-escape in standard b64:
// raw `+` → `-`, raw `/` → `_`.
assert_eq!(urlsafe_base64_encode(&[0xfb, 0xff]), "-_8");Gated on _base64: only the two base64 helpers need an optional crate, so
the rest of the module stays available in every feature set.