Skip to content

Commit d51cc11

Browse files
lmbollenreitermarkus
authored andcommitted
Add inline annotations to wrapping function calls in ufmt
This should make the compiler inline the function calls to increase performance.
1 parent b21563d commit d51cc11

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
111111
- `ufmt-impl` is now `ufmt`
112112
- `cas` is removed, atomic polyfilling is now opt-in via the `portable-atomic` feature.
113113
- `Vec::as_mut_slice` is now a public method.
114+
- `ufmt` functions are annotated with `inline`.
114115

115116
### Fixed
116117

src/ufmt.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use ufmt::uDisplay;
77
use ufmt_write::uWrite;
88

99
impl<S: StringStorage + ?Sized> uDisplay for StringInner<S> {
10+
#[inline]
1011
fn fmt<W>(&self, f: &mut ufmt::Formatter<'_, W>) -> Result<(), W::Error>
1112
where
1213
W: uWrite + ?Sized,
@@ -17,13 +18,15 @@ impl<S: StringStorage + ?Sized> uDisplay for StringInner<S> {
1718

1819
impl<S: StringStorage + ?Sized> uWrite for StringInner<S> {
1920
type Error = CapacityError;
21+
#[inline]
2022
fn write_str(&mut self, s: &str) -> Result<(), Self::Error> {
2123
self.push_str(s)
2224
}
2325
}
2426

2527
impl<S: VecStorage<u8> + ?Sized> uWrite for VecInner<u8, S> {
2628
type Error = CapacityError;
29+
#[inline]
2730
fn write_str(&mut self, s: &str) -> Result<(), Self::Error> {
2831
self.extend_from_slice(s.as_bytes())
2932
}

0 commit comments

Comments
 (0)