Skip to main content

encode

Function encode 

Source
pub fn encode<T: AsRef<[u8]>>(base: Base, input: T) -> String
Expand description

Encode with the given byte slice to base string.

§Examples

use multi_base::{Base, encode};

assert_eq!(encode(Base::Base58Btc, b"hello"), "zCn8eVZg");

§Performance

This function pre-allocates the exact capacity needed and constructs the result string efficiently by prepending the base code without requiring reallocation or memory moves.