Trait to_arraystring::ToArrayString

source ·
pub trait ToArrayString: Copy {
    type ArrayString: ArrayStringErased;

    const MAX_LENGTH: usize;

    // Required method
    fn to_arraystring(self) -> Self::ArrayString;
}
Expand description

A no-alloc version of ToString implemented for bool/integer/float types formatting into an ArrayString.

Required Associated Types§

source

type ArrayString: ArrayStringErased

An associated type to turn ArrayString’s const generic into a type generic, working around limitations of the current type system.

This is always ArrayString, but in generic code this only usable as impl Deref<Target = str>.

Required Associated Constants§

source

const MAX_LENGTH: usize

The maximum length that Self can be formatted into. This is used for the capacity generic of ArrayString.

§Note for implementors

This must match the capacity generic used in ArrayString, otherwise logic bugs and panics may occur.

Required Methods§

source

fn to_arraystring(self) -> Self::ArrayString

Returns the value’s formatted representation in an appropriately sized ArrayString.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ToArrayString for bool

source§

impl ToArrayString for char

source§

impl ToArrayString for f32

source§

impl ToArrayString for f64

source§

impl ToArrayString for i8

source§

impl ToArrayString for i16

source§

impl ToArrayString for i32

source§

impl ToArrayString for i64

source§

impl ToArrayString for i128

source§

impl ToArrayString for isize

source§

impl ToArrayString for u8

source§

impl ToArrayString for u16

source§

impl ToArrayString for u32

source§

impl ToArrayString for u64

source§

impl ToArrayString for u128

source§

impl ToArrayString for usize

source§

impl<const MAX_LENGTH: usize> ToArrayString for ArrayString<MAX_LENGTH>

source§

const MAX_LENGTH: usize = MAX_LENGTH

§

type ArrayString = ArrayString<MAX_LENGTH>

source§

fn to_arraystring(self) -> Self::ArrayString

Implementors§