Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lmbollen
Copy link

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:

   Compiling heapless v0.8.0 (/home/lucas/repos/heapless)
error[E0658]: use of unstable library feature 'build_hasher_simple_hash_one'
    --> src/indexmap.rs:1260:28
     |
1260 |     HashValue(build_hasher.hash_one(key) as u16)
     |                            ^^^^^^^^
     |
     = note: see issue #86161 <https://github.com/rust-lang/rust/issues/86161> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `heapless` due to previous error

But the implementation seems trivial and has been tested elsewhere.
I did not add uDisplay for Vec 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.

Did not add `uDisplay` for `Vec` because there is no trivial implementation.
This should make the compiler inline the function calls to increase performance.
@reitermarkus
Copy link
Member

We might want to consider adding uDebug, but don't know what the rusty way to do so would be.

Does ufmt not already provide an implementation for str?

@reitermarkus
Copy link
Member

Apparently not yet: japaric/ufmt#52

@reitermarkus
Copy link
Member

inline(always) is almost never needed, so let's use only inline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants