Skip to content

Commit

Permalink
add one more unwrap_or() example
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermalyga committed Dec 27, 2022
1 parent 03204f4 commit 191f5d7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ content = result.unwrap()

# Get the contained Ok value or a default value
content = result.unwrap_or("default text")
content = result.unwrap_or() # default None

# Get the contained Ok value or compute it from a callable
content = result.unwrap_or_else(lambda e: f"The exception was: {e}")
Expand Down

0 comments on commit 191f5d7

Please sign in to comment.