-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add uDisplay
for String
and inline ufmt
functions
#460
base: main
Are you sure you want to change the base?
Conversation
572f4bd
to
fd446d8
Compare
Does |
Apparently not yet: japaric/ufmt#52 |
|
can you rebase and fix CI? |
13827d7
to
e29673f
Compare
Done, also changed |
Cargo.toml
Outdated
@@ -42,11 +42,12 @@ mpmc_large = [] | |||
nightly = [] | |||
|
|||
[dependencies] | |||
portable-atomic = { version = "1.0", optional = true } | |||
defmt = { version = ">=0.2.0,<0.4", optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't autoformat Cargo.toml
CHANGELOG.md
Outdated
@@ -74,6 +75,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(always)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this no longer applies
e29673f
to
1d80d72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be generic over the StringInner
and the storage used.
src/ufmt.rs
Outdated
@@ -1,15 +1,28 @@ | |||
use crate::{storage::Storage, string::String, vec::VecInner}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use crate::{storage::Storage, string::String, vec::VecInner}; | |
use crate::{storage::Storage, string::StringInner, vec::VecInner}; |
src/ufmt.rs
Outdated
use ufmt_write::uWrite; | ||
|
||
impl<const SIZE: usize> uDisplay for String<SIZE> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl<const SIZE: usize> uDisplay for String<SIZE> { | |
impl<S: Storage> uDisplay for StringInner<S> { |
Did not add `uDisplay` for `Vec` because there is no trivial implementation.
This should make the compiler inline the function calls to increase performance.
1d80d72
to
c692a4b
Compare
Most likely the compiler already inlines the function calls, but afaik adding the annotation makes it more likely.
I could not build it locally due to:
But the implementation seems trivial and has been tested elsewhere.
I did not add
uDisplay
forVec
because the formatting is not trivial.We might want to consider adding
uDebug
, but don't know what the rusty way to do so would be.