https://deterministic.space/secret-life-of-cows.html
TIL that you can use Rust’s Cow
for representing a type that can either be borrowed or owned. This can be useful when you want to, for example, return either a static string (&'static str
) or a dynamically generated owned string (String
) from a function.
Leave a Reply