tonic/
util.rs

1//! Various utilities used throughout tonic.
2
3// some combinations of features might cause things here not to be used
4#![allow(dead_code)]
5
6pub(crate) mod base64 {
7    use base64::{
8        alphabet,
9        engine::{
10            general_purpose::{GeneralPurpose, GeneralPurposeConfig},
11            DecodePaddingMode,
12        },
13    };
14
15    pub(crate) const STANDARD: GeneralPurpose = GeneralPurpose::new(
16        &alphabet::STANDARD,
17        GeneralPurposeConfig::new()
18            .with_encode_padding(true)
19            .with_decode_padding_mode(DecodePaddingMode::Indifferent),
20    );
21
22    pub(crate) const STANDARD_NO_PAD: GeneralPurpose = GeneralPurpose::new(
23        &alphabet::STANDARD,
24        GeneralPurposeConfig::new()
25            .with_encode_padding(false)
26            .with_decode_padding_mode(DecodePaddingMode::Indifferent),
27    );
28}