From 572f4bd1ebfac84b4329ce570f500ae0ad9e83ea Mon Sep 17 00:00:00 2001 From: Lucas Bollen Date: Wed, 28 Feb 2024 10:22:11 +0100 Subject: [PATCH] Add `inline` annotations to wrapping function calls in `ufmt` This should make the compiler inline the function calls to increase performance. --- src/ufmt.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ufmt.rs b/src/ufmt.rs index fc78dcd296..648fd8eb7f 100644 --- a/src/ufmt.rs +++ b/src/ufmt.rs @@ -2,6 +2,7 @@ use crate::{string::String, vec::Vec}; use ufmt_write::uWrite; impl uDisplay for String { + #[inline(always)] fn fmt(&self, f: &mut ufmt::Formatter<'_, W>) -> Result<(), W::Error> where W: uWrite + ?Sized, @@ -12,6 +13,7 @@ impl uDisplay for String { impl uWrite for String { type Error = (); + #[inline(always)] fn write_str(&mut self, s: &str) -> Result<(), Self::Error> { self.push_str(s) } @@ -19,6 +21,7 @@ impl uWrite for String { impl uWrite for Vec { type Error = (); + #[inline(always)] fn write_str(&mut self, s: &str) -> Result<(), Self::Error> { self.extend_from_slice(s.as_bytes()) }