top | item 13327886

(no title)

mkawia | 9 years ago

Think as an author of a function that does something that can fail .

the signature ;"fn risky_shtuff() -> Result<Response , Err)"

Rust guarantees to you as the author who ever uses this function HAS to handle both cases (even if it's an unwrap).

However Rust doesn't stop you form making functions that instead return Option ,bools or even strings ,but you'd be actively working against very strong convention.

discuss

order

EugeneOZ|9 years ago

if function doesn't return anything (void) as pcwalton saying, it doesn't matter. So or we are talking about returning value or not.