Hacker News new | ask | show | jobs
by SpaceNugget 756 days ago
I'm not super familiar with Zig, but that appears to be the same as the rust function signature fn setData<P, B>(pins: P, bus: B, data: u8) -> B;

in rust, the P and B are resolved at compile time, not at runtime. If you wanted dynamic dispatch the types would be Box<dyn B>

1 comments

Yes, it's essentially the same, the comptime attribute on the pins arg is quite important though (in the function body that's not shown).