3 ms·
A `Result<T, Error>` can either be `Ok(value)` or `Error(value)` where value must be of type `T` or `Error` respectively. If you don't want to carry any informa
by CodesInChaos 5y ago
A `Result<T, Error>` can either be `Ok(value)` or `Error(value)` where value must be of type `T` or `Error` respectively. If you don't want to carry any information you use the unit type `()`, which has a single value `()`. So in `Ok(())` the outer parentheses are for constructing the OK result, while the inner parentheses are the unit value.
`(i64,)` is a tuple with a single component, the trailing comma disambiguates it from plain parentheses. I haven't needed one of those so far.