|
|
|
|
|
by leshow
1881 days ago
|
|
Monomorphization is not a user action of copy pasting, it's something the compiler does with parametric code. If we're talking about Rust it means when you write: fn id<T>(t: T) { }
fn main() {
id(String::from("foo"));
id(1_usize);
}
The Rust compiler will generate a method of `id` that works for both String and usize, so there will be two copies of the function with a slight variation in your binary. That process is called monomorphization.> Which was exactly what I was experimenting with: A single queue worker that can handle different cases. Honestly, it made Rust almost not worth it for me. Sadly, I was too deep to turn back so I wound up doing the whole thing in Rust. I have tons of copy-paste code. It is ugly and it is bothering me. You can easily use generics, there is no reason to copy paste code like this |
|