Guest7221 has left #rust-embedded [Error from remote client]
jasperw has quit [Server closed connection]
jasperw has joined #rust-embedded
crabbedhaloablut has joined #rust-embedded
fooker has quit [Server closed connection]
fooker has joined #rust-embedded
emerent_ has joined #rust-embedded
emerent has quit [Killed (zinc.libera.chat (Nickname regained by services))]
emerent_ is now known as emerent
Guest7221 has joined #rust-embedded
notgull has quit [Ping timeout: 246 seconds]
notgull has joined #rust-embedded
IlPalazzo-ojiisa has joined #rust-embedded
korken89[m] has quit [Quit: Idle timeout reached: 172800s]
Noah[m] has quit [Quit: Idle timeout reached: 172800s]
ithinuel[m] has quit [Quit: Idle timeout reached: 172800s]
<ryan-summers[m]>
Man, my `menu` changes got merged and released before I even came back online for the day :) Thanks thejpster and eldruin - I'll go ahead and publish the 0.4.0 release
<spinfast[m]>
Is there something like a Box<T> but for statically allocated things so I can do like StaticRef<dyn X>
<spinfast[m]>
the use case I have is the SAI peripheral for iMX.RT which can have 1 to 4 data channels associated, and I'm working on creating a Builder for the peripheral
K900 has joined #rust-embedded
<K900>
`&dyn T`
<ryan-summers[m]>
Is there a meaningful difference between dyn T and impl T?
<spinfast[m]>
Or I guess alternatively, I create something like.. TxDataPins<T0, T1, T2, T3> = (T0, T1, T2, T4); and go from there, adding another generic param I guess
<spinfast[m]>
* Or I guess alternatively, I create something like.. type TxDataPins\<T0, T1, T2, T3> = (T0, T1, T2, T4); and go from there, adding another generic param I guess
<spinfast[m]>
* Or I guess alternatively, I create something like.. type TxDataPins\<T0, T1, T2, T3> = (T0, T1, T2, T3); and go from there, adding another generic param I guess
<jannic[m]>
<ryan-summers[m]> "Is there a meaningful difference..." <- I think `impl T` will be monomorphised for each concrete T. So it might be slightly faster, but also produce a larger binary if you use it with more than one actual T.
IlPalazzo-ojiisa has quit [Quit: Leaving.]
<fu5ha[m]>
<ryan-summers[m]> "Is there a meaningful difference..." <- Completely different things :P `impl Trait` can mean different things in different places, but it's *always* resolved by the compiler to some *single* actual type `T` at compiletime (like a generic). `&impl T` is just a regular thin pointer to that type that... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/hlODijnitWkMkOBUiBSnmTfS>)
<fu5ha[m]>
(Just realized you may already know this and were asking the question specifically in reference to the situation presented, which would be a different answer)
JonathanDickinso has quit [Quit: Idle timeout reached: 172800s]
mightypork has joined #rust-embedded
<ryan-summers[m]>
Ah interesting, so when wanting a trait object, it's probably better to do &dyn Trait. Is there any value in having the distinction in the language? It feels to me, as a user, to be a purely semantical issue
<dirbaio[m]>
depends on what you want
<ryan-summers[m]>
Ah okay yeah I had to reread the discussion. It sounds like it has to do with allocation sizes etc.
<ryan-summers[m]>
Where there could be some niche locations where you'd want dyn instead of impl
<dirbaio[m]>
generics/impl make faster code because the compiler inlines and optimzies everything
<dirbaio[m]>
at the cost of bigger code size if you use multiple types
<dirbaio[m]>
but perhaps that cost is OK if you really want max perf
<ryan-summers[m]>
But still, this is essentially (mostly) irrelevant to a language user
<ryan-summers[m]>
The performance characteristics are likely exceptionally marginal
<dirbaio[m]>
dyn avoids the code growing for each type you use, but is slower, and bigger code if you actually use only one type
<dirbaio[m]>
dyn allows putting different types in the same array, impl/generics don't
<dirbaio[m]>
ryan-summers[m]: oh no it can make a big difference in some cases
<dirbaio[m]>
especially in embedded where you care about code size a lot, or care about perf a lot, depending on what you're doing
<dirbaio[m]>
and that's the whole point of Rust: give you the tools, don't hide how they work under the hood, so you can choose the best one for your use case to optimize
<thejpster[m]>
<ryan-summers[m]> "Man, my `menu` changes got..." <- Don’t forget to tag it!
fuse117[m] has joined #rust-embedded
<fuse117[m]>
is there a preferred method for debugging embedded rust apps? i am hitting some stack overflows on an app running on an nrf9160. i have never debugged an embedded rust app, but i feel like i need to now
barnabyw[m] has joined #rust-embedded
<barnabyw[m]>
<fuse117[m]> "is there a preferred method..." <- it’s a while since I’ve used it, but probe-rs and vscode can be used for interactive debugging https://probe.rs/docs/tools/debugger/
barnaby has joined #rust-embedded
TimSmall[m] has joined #rust-embedded
<TimSmall[m]>
barnabyw[m]: fuse117: ...or Vim (Vimspector), or any other editor or graphical debugger which supports the Debug Adapter Protocol (DAP).
vollbrecht[m] has quit [Quit: Idle timeout reached: 172800s]
kevlan[m] has quit [Quit: Idle timeout reached: 172800s]
SergioGasquez[m] has quit [Quit: Idle timeout reached: 172800s]
AdamHott[m] has quit [Quit: Idle timeout reached: 172800s]
<fu5ha[m]>
<ryan-summers[m]> "But still, this is essentially..." <- Not really... They're very distinct concepts although can totally understand they feel similar. There's overlap in the things they can accomplish but dyn lets you write code that is impossible to express with generics/impl trait. A generic type, whether an... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/NAOIMpZLhJpOMzPkcmghehaX>)
geky[m] has quit [Quit: Idle timeout reached: 172800s]
sknebel has quit [Server closed connection]
firefrommoonligh has quit [Quit: Idle timeout reached: 172800s]
sknebel has joined #rust-embedded
kenny has quit [Server closed connection]
kenny has joined #rust-embedded
danielb[m] has quit [Quit: Idle timeout reached: 172800s]
mabez[m] has quit [Quit: Idle timeout reached: 172800s]
Guest7221 has left #rust-embedded [Error from remote client]