The Secret Life of Cows

in Links

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.

If you enjoy my writing, you can subscribe to my email newsletter to get notified every time I publish a new post.

You can also subscribe to my posts using my RSS feed.