Add inline annotations to wrapping function calls in ufmt

This should make the compiler inline the function calls to increase performance.
This commit is contained in:
Lucas Bollen 2024-02-28 10:22:11 +01:00 committed by Markus Reiter
parent b21563dfa7
commit d51cc11618
No known key found for this signature in database
2 changed files with 4 additions and 0 deletions

View File

@ -111,6 +111,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `ufmt-impl` is now `ufmt`
- `cas` is removed, atomic polyfilling is now opt-in via the `portable-atomic` feature.
- `Vec::as_mut_slice` is now a public method.
- `ufmt` functions are annotated with `inline`.
### Fixed

View File

@ -7,6 +7,7 @@ use ufmt::uDisplay;
use ufmt_write::uWrite;
impl<S: StringStorage + ?Sized> uDisplay for StringInner<S> {
#[inline]
fn fmt<W>(&self, f: &mut ufmt::Formatter<'_, W>) -> Result<(), W::Error>
where
W: uWrite + ?Sized,
@ -17,6 +18,7 @@ impl<S: StringStorage + ?Sized> uDisplay for StringInner<S> {
impl<S: StringStorage + ?Sized> uWrite for StringInner<S> {
type Error = CapacityError;
#[inline]
fn write_str(&mut self, s: &str) -> Result<(), Self::Error> {
self.push_str(s)
}
@ -24,6 +26,7 @@ impl<S: StringStorage + ?Sized> uWrite for StringInner<S> {
impl<S: VecStorage<u8> + ?Sized> uWrite for VecInner<u8, S> {
type Error = CapacityError;
#[inline]
fn write_str(&mut self, s: &str) -> Result<(), Self::Error> {
self.extend_from_slice(s.as_bytes())
}