pub fn try_encode_into<T: AsRef<[u8]>>(
data: T,
buf: &mut String,
) -> Result<(), TryReserveError>Available on crate feature
alloc only.Expand description
Encode arbitrary octets as base16 into the given String.
This function writes encoded octets into the given String. This function
will allocate at most once.
§Errors
If the given string’s capacity overflows, or the allocator reports a failure, then an error is returned.
§Examples
let data = b"Artichoke Ruby";
let mut buf = String::new();
scolapasta_hex::try_encode_into(data, &mut buf)?;
assert_eq!(buf, "4172746963686f6b652052756279");