Skip to main content

Alphabet

Trait Alphabet 

Source
pub trait Alphabet:
    'static
    + Copy
    + Debug
    + Eq
    + Send
    + Sized
    + Sync {
    type Unpadded: Alphabet;

    const BASE: u8;
    const DECODER: &'static [DecodeStep];
    const ENCODER: &'static [EncodeStep];
    const PADDED: bool;

    // Provided methods
    fn decode_3bytes(src: &[u8], dst: &mut [u8]) -> i16 { ... }
    fn decode_6bits(src: u8) -> i16 { ... }
    fn encode_3bytes(src: &[u8], dst: &mut [u8]) { ... }
    fn encode_6bits(src: i16) -> u8 { ... }
}
Expand description

Core encoder/decoder functions for a particular Base64 alphabet.

Required Associated Constants§

Source

const BASE: u8

First character in this Base64 alphabet.

Source

const DECODER: &'static [DecodeStep]

Decoder passes

Source

const ENCODER: &'static [EncodeStep]

Encoder passes

Source

const PADDED: bool

Is this encoding padded?

Required Associated Types§

Source

type Unpadded: Alphabet

Unpadded equivalent of this alphabet.

For alphabets that are unpadded to begin with, this should be Self.

Provided Methods§

Source

fn decode_3bytes(src: &[u8], dst: &mut [u8]) -> i16

Decode 3 bytes of a Base64 message.

Source

fn decode_6bits(src: u8) -> i16

Decode 6-bits of a Base64 message.

Source

fn encode_3bytes(src: &[u8], dst: &mut [u8])

Encode 3-bytes of a Base64 message.

Source

fn encode_6bits(src: i16) -> u8

Encode 6-bits of a Base64 message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Alphabet for Base64

Source§

const BASE: u8 = b'A'

Source§

const DECODER: &'static [DecodeStep] = DECODER

Source§

const ENCODER: &'static [EncodeStep] = ENCODER

Source§

const PADDED: bool = true

Source§

type Unpadded = Base64Unpadded

Source§

impl Alphabet for Base64Bcrypt

Source§

const BASE: u8 = b'.'

Source§

const DECODER: &'static [DecodeStep]

Source§

const ENCODER: &'static [EncodeStep]

Source§

const PADDED: bool = false

Source§

type Unpadded = Base64Bcrypt

Source§

impl Alphabet for Base64Crypt

Source§

const BASE: u8 = b'.'

Source§

const DECODER: &'static [DecodeStep]

Source§

const ENCODER: &'static [EncodeStep]

Source§

const PADDED: bool = false

Source§

type Unpadded = Base64Crypt

Source§

impl Alphabet for Base64Pbkdf2

Source§

const BASE: u8 = b'A'

Source§

const DECODER: &'static [DecodeStep] = DECODER

Source§

const ENCODER: &'static [EncodeStep] = ENCODER

Source§

const PADDED: bool = false

Source§

type Unpadded = Base64Pbkdf2

Source§

impl Alphabet for Base64ShaCrypt

Source§

const BASE: u8 = b'.'

Source§

const DECODER: &'static [DecodeStep]

Source§

const ENCODER: &'static [EncodeStep]

Source§

const PADDED: bool = false

Source§

type Unpadded = Base64ShaCrypt

Source§

impl Alphabet for Base64Unpadded

Source§

const BASE: u8 = b'A'

Source§

const DECODER: &'static [DecodeStep] = DECODER

Source§

const ENCODER: &'static [EncodeStep] = ENCODER

Source§

const PADDED: bool = false

Source§

type Unpadded = Base64Unpadded

Source§

impl Alphabet for Base64Url

Source§

const BASE: u8 = b'A'

Source§

const DECODER: &'static [DecodeStep] = DECODER

Source§

const ENCODER: &'static [EncodeStep] = ENCODER

Source§

const PADDED: bool = true

Source§

type Unpadded = Base64UrlUnpadded

Source§

impl Alphabet for Base64UrlUnpadded

Source§

const BASE: u8 = b'A'

Source§

const DECODER: &'static [DecodeStep] = DECODER

Source§

const ENCODER: &'static [EncodeStep] = ENCODER

Source§

const PADDED: bool = false

Source§

type Unpadded = Base64UrlUnpadded