Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions base64ct/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
errors::{Error, InvalidEncodingError, InvalidLengthError},
variant::Variant,
};
use core::str;
use core::{fmt::Debug, str};

#[cfg(feature = "alloc")]
use alloc::{string::String, vec::Vec};
Expand All @@ -16,7 +16,7 @@ const PAD: u8 = b'=';
///
/// This trait must be imported to make use of any Base64 variant defined
/// in this crate.
pub trait Encoding {
pub trait Encoding: 'static + Copy + Clone + Debug + Send + Sized + Sync {
/// Decode a Base64 string into the provided destination buffer.
fn decode(src: impl AsRef<[u8]>, dst: &mut [u8]) -> Result<&[u8], Error>;

Expand Down
4 changes: 2 additions & 2 deletions base64ct/src/variant.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Base64 variants

use core::ops::Range;
use core::{fmt::Debug, ops::Range};

pub mod bcrypt;
pub mod crypt;
pub mod standard;
pub mod url;

/// Core encoder/decoder functions for a particular Base64 variant
pub trait Variant {
pub trait Variant: 'static + Copy + Clone + Debug + Send + Sized + Sync {
/// Unpadded equivalent of this variant.
///
/// For variants that are unpadded to begin with, this should be `Self`.
Expand Down
1 change: 1 addition & 0 deletions base64ct/src/variant/bcrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::{Decode, Encode, Variant};
/// ./ [A-Z] [a-z] [0-9]
/// 0x2e-0x2f, 0x41-0x5a, 0x61-0x7a, 0x30-0x39
/// ```
#[derive(Copy, Clone, Debug)]
pub struct Base64Bcrypt;

impl Variant for Base64Bcrypt {
Expand Down
1 change: 1 addition & 0 deletions base64ct/src/variant/crypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::{Decode, Encode, Variant};
/// [.-9] [A-Z] [a-z]
/// 0x2e-0x39, 0x41-0x5a, 0x61-0x7a
/// ```
#[derive(Copy, Clone, Debug)]
pub struct Base64Crypt;

impl Variant for Base64Crypt {
Expand Down
2 changes: 2 additions & 0 deletions base64ct/src/variant/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::{Decode, Encode, Variant};
/// [A-Z] [a-z] [0-9] + /
/// 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2b, 0x2f
/// ```
#[derive(Copy, Clone, Debug)]
pub struct Base64;

impl Variant for Base64 {
Expand All @@ -24,6 +25,7 @@ impl Variant for Base64 {
/// [A-Z] [a-z] [0-9] + /
/// 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2b, 0x2f
/// ```
#[derive(Copy, Clone, Debug)]
pub struct Base64Unpadded;

impl Variant for Base64Unpadded {
Expand Down
2 changes: 2 additions & 0 deletions base64ct/src/variant/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::{Decode, Encode, Variant};
/// [A-Z] [a-z] [0-9] - _
/// 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2d, 0x5f
/// ```
#[derive(Copy, Clone, Debug)]
pub struct Base64Url;

impl Variant for Base64Url {
Expand All @@ -24,6 +25,7 @@ impl Variant for Base64Url {
/// [A-Z] [a-z] [0-9] - _
/// 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2d, 0x5f
/// ```
#[derive(Copy, Clone, Debug)]
pub struct Base64UrlUnpadded;

impl Variant for Base64UrlUnpadded {
Expand Down