4 ms·
unwrap is also kind of neat in that it 'unwraps' the value, so something that converts strings to ints intval = convert("42").unwrap() is like if intval,
by justinsaccount 10y ago
unwrap is also kind of neat in that it 'unwraps' the value, so something that converts strings to ints
intval = convert("42").unwrap()
is like
if intval, err := convert("42"); err != nil { panic(err) }
but you can not do
intval = convert("42")
and pretend it can't fail, but in go you can do
intval, _ := convert("42")
the rust unwrap would most similar to a
intval := mustConvert("42")
in go, but 'must' type functions don't exist for every method in every library.