Encode to base64

    0

    0

    Giovanny Gongora

    Codiga's Rust Recipes

    from string to base64

    use std::str;
    use base64::{encode, decode};
    
    fn main() -> Result<()> {
      let hello = "hello rustaceans";
      let encoded = encode(hello);
      println!("origin: {}", str::from_utf8(hello)?);
      println!("base64 encoded: {}", encoded);
      Ok(())
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.