[][src]Trait itsdangerous::base64::Base64Sized

pub trait Base64Sized {
    type InputSize: ArrayLength<u8>;
    type OutputSize: ArrayLength<u8>;
    fn encode(
        input: GenericArray<u8, Self::InputSize>
    ) -> GenericArray<u8, Self::OutputSize>;
fn output_size() -> usize; }

A trait that is implemented by Base64SizedEncoder that provides facilities for encoding a GenericArray as base64. All sizing is computed during compile time.

Associated Types

Loading content...

Required methods

fn encode(
    input: GenericArray<u8, Self::InputSize>
) -> GenericArray<u8, Self::OutputSize>

fn output_size() -> usize

Loading content...

Implementors

impl<N> Base64Sized for Base64SizedEncoder<N> where
    N: Unsigned + ArrayLength<u8>,
    N: Rem<U3>,
    N: Div<U3>,
    Quot<N, U3>: Mul<U4>,
    Mod<N, U3>: Min<U1>,
    Mod<N, U3>: Add<Minimum<Mod<N, U3>, U1>>,
    Prod<Quot<N, U3>, U4>: Add<Sum<Mod<N, U3>, Minimum<Mod<N, U3>, U1>>>,
    Sum<Prod<Quot<N, U3>, U4>, Sum<Mod<N, U3>, Minimum<Mod<N, U3>, U1>>>: Unsigned + ArrayLength<u8>, 
[src]

Implementation of the Base64Sized trait. This does the actual computation.

A simple example is as follows:

use itsdangerous::base64::{Base64Sized, Base64SizedEncoder};
use hmac::digest::generic_array::*;

let arr = arr![u8; 1, 2, 3];
let result = Base64SizedEncoder::encode(arr);

type InputSize = N

type OutputSize = Sum<Prod<Quot<N, U3>, U4>, Sum<Mod<N, U3>, Minimum<Mod<N, U3>, U1>>>

Loading content...