you are viewing a single comment's thread
view the rest of the comments
[–] 27 points 11 months ago (2 children)

There is a function that does what you are asking for.

.unarap_or()

It either unwraps the value or uses a provided default. Personally, i think unwrap() should be renamed unwrap_or_panic() to follow existing conventions and prevent confusion for non-rust programmers.

  • source
  • parent
  • hideshow 2 child comments