Integer

Trait Integer 

Source
pub trait Integer: ToIntegerImpl + Copy { }
Expand description

An abstraction over all integer types. Integers can be formatted as Subscript, Subscript or VulgarFraction.

Use this trait if you want to abstract over integers that can be formatted by one of this crate’s formats:

use fmtastic::{Subscript, Integer};

assert_eq!("x₁", x_with_index(1u8));
assert_eq!("x₅", x_with_index(5u64));

fn x_with_index<T: Integer>(index: T) -> String {
    format!("x{}", Subscript(index))
}

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Integer for i8

Source§

impl Integer for i16

Source§

impl Integer for i32

Source§

impl Integer for i64

Source§

impl Integer for i128

Source§

impl Integer for isize

Source§

impl Integer for u8

Source§

impl Integer for u16

Source§

impl Integer for u32

Source§

impl Integer for u64

Source§

impl Integer for u128

Source§

impl Integer for usize

Implementors§