Function awint_ext::prelude::bits_to_vec_radix[][src]

pub fn bits_to_vec_radix(
    bits: &Bits,
    signed: bool,
    radix: u8,
    upper: bool,
    minimum_chars: usize
) -> Result<Vec<u8>, SerdeError>
Expand description

Creates a Vec<u8> representing self. This function performs allocation. This is a wrapper around awint_core::Bits::to_bytes_radix that truncates leading zeros and possibly adds - as a sign indicator. An additional minimum_chars specifies the minimum number of characters that should exist. If the sign indicator plus significand length is less than minimum_chars, zeros will be filled between the sign indicator and significand, just like Rust’s built in {:0d} formatting.

Errors

This can only return an error if radix is not in the range 2..=36 or if resource exhaustion occurs.