jcroisant has quit [Quit: Connection closed for inactivity]
cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded
sauce has joined #rust-embedded
<re_irc>
<@boiethios:matrix.org> Is there any stack-based vector working with a generic array type instead of a const generic? I find the const generics not really useful, so I'd rather have a regular type.
<re_irc>
There is smallvec, but it works with an allocator.
<re_irc>
<@xiretza:xiretza.xyz> what do you mean by "a generic array type"?
<re_irc>
<@xiretza:xiretza.xyz> oh I see, smallvec implements an "Array" trait for a couple array sizes - why is that preferable to being able to pass any size?
<re_irc>
<@boiethios:matrix.org> : Because my lib needs a bunch of different generic numbers in a trait, and I'd rather have associated types than "Foo<const A: usize, const B: usize, const C: usize, /*etc*/>". At the moment, an associated const cannot be used for anything type-related.
<re_irc>
<@bugadani:matrix.org> heapless 0.6 works with the old typenum crate that represents numbers as types
<re_irc>
<@boiethios:matrix.org> : I'll use that, thanks!
<re_irc>
<@boiethios:matrix.org> I forgot that's the best of the 2 worlds, the user doesn't have to specify the type, and I can use the “number” for creating an array.
<re_irc>
<@boiethios:matrix.org> Working on embedded creates a lot of new problems when using the typesystem 😅
<re_irc>
<@burrbull:matrix.org> : You can wrap constant in helper struct. "struct U<const N: usize>" and then use this wrapper as associated type
<re_irc>
<@boiethios:matrix.org> Since my project uses a nightly compiler, I bit the bullet and used "generic_const_exprs". The integration tests pass so far.
IlPalazzo-ojiisa has joined #rust-embedded
lehmrob has quit [Ping timeout: 260 seconds]
emerent has quit [Ping timeout: 260 seconds]
emerent has joined #rust-embedded
lehmrob has joined #rust-embedded
IlPalazzo-ojiisa has quit [Remote host closed the connection]