domain::utils::base64

Function display

source
pub fn display<B, W>(bytes: &B, f: &mut W) -> Result
where B: AsRef<[u8]> + ?Sized, W: Write,
Expand description

Encodes binary data in base64 and writes it into a format stream.

This function is intended to be used in implementations of formatting traits:

use core::fmt;
use domain::utils::base64;

struct Foo<'a>(&'a [u8]);

impl<'a> fmt::Display for Foo<'a> {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        base64::display(&self.0, f)
    }
}