Skip to main content

ToBase64

Trait ToBase64 

Source
pub trait ToBase64 {
    // Required method
    fn to_base64(&self, config: Config) -> String;
}
Expand description

A trait for converting a value to base64 encoding.

Required Methods§

Source

fn to_base64(&self, config: Config) -> String

Converts the value of self to a base64 value following the specified format configuration, returning the owned string.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ToBase64 for [u8]

Source§

fn to_base64(&self, config: Config) -> String

Turn a vector of u8 bytes into a base64 string.

§Example
extern crate rustc_serialize;
use rustc_serialize::base64::{ToBase64, STANDARD};

fn main () {
    let str = [52,32].to_base64(STANDARD);
    println!("base 64 output: {:?}", str);
}
Source§

impl<'a, T: ?Sized + ToBase64> ToBase64 for &'a T

Source§

fn to_base64(&self, config: Config) -> String

Implementors§