heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Add `uDisplay` for `String` and inline `ufmt` functions

Open lmbollen opened this issue 1 year ago • 5 comments

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.

lmbollen avatar Feb 28 '24 09:02 lmbollen

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 avatar Feb 29 '24 12:02 reitermarkus

Apparently not yet: https://github.com/japaric/ufmt/issues/52

reitermarkus avatar Feb 29 '24 12:02 reitermarkus

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

reitermarkus avatar Feb 29 '24 19:02 reitermarkus

can you rebase and fix CI?

Dirbaio avatar Jun 30 '24 22:06 Dirbaio

can you rebase and fix CI?

Done, also changed #[inline(always)] to #[inline]

lmbollen avatar Jul 01 '24 07:07 lmbollen