API: Add err_or
and err_or_else
to Option
#80190
Labels
A-error-handling
Area: Error handling
A-result-option
Area: Result and Option combinators
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
PG-error-handling
Project group: Error handling (https://github.com/rust-lang/project-error-handling)
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
sometimes, particularly when interfacing with C libraries which provide their own errno-like API (
GetLastError
,SDL_GetError
, etc), Rust bindings may opt to returnOption<ErrorType>
to model the absence of an error.This could then be 'upgraded' to a
Result<T, E>
, in a manner similar took_or
:pros
unwrap_none
/expect_none
Tracking issue for Option::expect_none(msg) and unwrap_none() #62633)cons
error
, might cause confusionunwrap_none
yet)The text was updated successfully, but these errors were encountered: