Trait Octal
trait Octal: PointeeSized
o formatting.
The Octal trait should format its output as a number in base-8.
For primitive signed integers (i8 to i128, and isize),
negative values are formatted as the two’s complement representation.
The alternate flag, #, adds a 0o in front of the output.
For more information on formatters, see the module-level documentation.
Examples
Basic usage with i32:
let x = 42; // 42 is '52' in octal
assert_eq!;
assert_eq!;
assert_eq!;
Implementing Octal on a type:
use fmt;
;
let l = Length;
assert_eq!;
assert_eq!;
Required Methods
fn fmt(self: &Self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter.
Errors
This function should return
Errif, and only if, the providedFormatterreturnsErr. String formatting is considered an infallible operation; this function only returns aResultbecause writing to the underlying stream might fail and it must provide a way to propagate the fact that an error has occurred back up the stack.
Implementors
impl Octal for i32impl<T: fmt::Octal> Octal for Saturating<T>impl Octal for isizeimpl Octal for u64impl Octal for u8impl Octal for i64impl<T: fmt::Octal> Octal for Wrapping<T>impl Octal for i8impl<T> Octal for NonZero<T>impl Octal for u128impl Octal for u16impl Octal for i128impl Octal for i16impl<T: PointeeSized + Octal> Octal for &Timpl Octal for u32impl<T: PointeeSized + Octal> Octal for &mut Timpl Octal for usize