One of the things that new Rust developers struggle with is how to handle conversions between types. For example, "I have a str, how do I get a String?" has several answers (and it's not necessarily the same patterns as going from a String to a str - e.g. .to_string() is str-to-String specific), and it gets trickier if you want to return "str or String" (have to use Cow, plus there's also the Borrow and BorrowMut traits which have subtly different use cases to the AsRef and AsMut traits.
It'd be great if someone could give an overview of this in a newbie friendly way; all the information is available in decent format for consumption so it should just be a matter of learning it yourself and then presenting on it.
On a related note, at least one of the conversion traits (From) are also used for error handling with the try! macro (and I believe the upcoming ? syntax on Result too) to cut down on boilerplate, so it's probably worth touching on that too? (and/or error handling techniques could be a separate talk too.)
One of the things that new Rust developers struggle with is how to handle conversions between types. For example, "I have a
str
, how do I get aString
?" has several answers (and it's not necessarily the same patterns as going from aString
to astr
- e.g..to_string()
isstr
-to-String
specific), and it gets trickier if you want to return "str
orString
" (have to useCow
, plus there's also theBorrow
andBorrowMut
traits which have subtly different use cases to theAsRef
andAsMut
traits.It'd be great if someone could give an overview of this in a newbie friendly way; all the information is available in decent format for consumption so it should just be a matter of learning it yourself and then presenting on it.
On a related note, at least one of the conversion traits (
From
) are also used for error handling with thetry!
macro (and I believe the upcoming?
syntax onResult
too) to cut down on boilerplate, so it's probably worth touching on that too? (and/or error handling techniques could be a separate talk too.)Useful sources for people putting talks together: