Trait Octal
pub 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, 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 i128impl Octal for i16impl Octal for i32impl Octal for i64impl Octal for i8impl Octal for isizeimpl Octal for u128impl Octal for u16impl Octal for u32impl Octal for u64impl Octal for u8impl Octal for usizeimpl<T> Octal for NonZero<T> where T: ZeroablePrimitive + Octal,impl<T: Octal> Octal for Saturating<T>impl<T: Octal> Octal for Wrapping<T>impl<T: PointeeSized + Octal> Octal for &Timpl<T: PointeeSized + Octal> Octal for &mut T