-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
I sadly barely get to use ?
, because I find myself not using Result<> as often because it just doesn't fit in. For example, I instead return a struct with a success
boolean at one point, or I wanna completely ignore errors the other. There should be a way for ?
to detect return values and use some trait to return an error.
For example:
struct Stuff {
// some fields here
success: bool
}
impl Try for Stuff {
fn err(error: std::error::Error) -> Stuff {
Stuff{
// some fields here
success: false;
}
}
}
Also, ()
return values would implement the trait as well, but return.. well... nothing.
If the suggestion sounds stupid to you - sorry for disturbing :(
Metadata
Metadata
Assignees
Labels
No labels