Skip to main content

LogosStrPushInt

Trait LogosStrPushInt 

Source
pub trait LogosStrPushInt {
    // Required method
    fn push_i64(&mut self, v: i64);
}
Expand description

Fast decimal append of an i64 to a String. The write!(s, "{}", i) the string-builder used to emit routes every integer through the fmt::Display vtable + formatter machinery; this writes the digits straight into a stack buffer and push_strs once — ~1.5× faster on integer-heavy string building (measured: 20.7ms → 13.6ms on a 2M-int build loop), byte-identical output.

Exposed as a method so codegen can emit s.push_i64(x) and get the same auto-ref/deref behavior as the existing s.push_str(&x) fast path.

Required Methods§

Source

fn push_i64(&mut self, v: i64)

Implementations on Foreign Types§

Source§

impl LogosStrPushInt for String

Source§

fn push_i64(&mut self, v: i64)

The decimal digits of v, written straight into the string’s spare capacity from the last digit back, two digits a division: no buffer to copy from and no copy call per number.

Implementors§