pub struct ItoaTmp { /* private fields */ }Expand description
A short-lived version of Itoa
This version doesn’t save the formatting
computation, and is meant for cases where the
lifetime of the formatted output &str is very brief.
This version has less overhead, but the string must be formatted everytime you need it.
See crate::itoa!() for a quick 1-line format macro.
assert_eq!(ItoaTmp::new().format(10), "10");You could keep a ItoaTmp around to use it
as a factory to keep formatting new strings,
as it will reuse the inner buffer:
let mut itoa = ItoaTmp::new();
assert_eq!(itoa.format(10), "10");
assert_eq!(itoa.format(20), "20");
assert_eq!(itoa.format(30), "30");§Size
assert_eq!(std::mem::size_of::<ItoaTmp>(), 40);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ItoaTmp
impl RefUnwindSafe for ItoaTmp
impl Send for ItoaTmp
impl Sync for ItoaTmp
impl Unpin for ItoaTmp
impl UnwindSafe for ItoaTmp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more