pub fn encode_into<T: AsRef<[u8]>>(base: Base, input: T, buffer: &mut String)Expand description
Encode with the given byte slice to base string, writing into an existing buffer.
This is a zero-copy variant of encode that reuses an existing String buffer,
avoiding allocations when encoding multiple values in a loop.
The buffer will be cleared before encoding, then filled with the base code prefix followed by the encoded data.
§Examples
use multi_base::{Base, encode_into};
let mut buffer = String::new();
// Encode multiple values reusing the same buffer
encode_into(Base::Base58Btc, b"hello", &mut buffer);
assert_eq!(buffer, "zCn8eVZg");
encode_into(Base::Base64, b"world", &mut buffer);
assert_eq!(buffer, "md29ybGQ");§Performance
When encoding many values, this function can be significantly faster than
encode as it reuses the allocated buffer instead of allocating a new
String for each encoding operation.