The following is from a comment on another website:
[In] Rust, they [generics] are [monomorphized] by default, but there’s a
dynamic
attribute that you can stick on them to ensure that they are not. In the dynamic case, the compiler generates a small vtable with functions implementing all of the dispatch required by the generic.— Zig-style generics are not well-suited for most languages | Lobsters (comment)
I've not heard of a #[dynamic]
attribute that changes trait dispatch, nor do I see one in the Reference. At first I figured this comment may have been referring to trait objects and their dyn
keyword, but a subsequent comment seems to imply that this "dynamic
attribute" can be applied (to functions?) without changing a library's API, which I don't think matches dyn
. What is the "dynamic
attribute"?