[−][src]Macro try_or_wrap_s::try_or_wrap
Helper macro to wrap ?
into something else, for Result
Example
ⓘThis example is not tested
fn foo(input: Input) -> Result<Result<FinalOutput, InvalidInputError>, DatabaseError> { let validated_input: ValidatedInput = try_or_wrap!(validate_input_with_database(input)?, Ok); Ok(Ok(do_stuff_with_validated_input(validated_input)?)) } fn validate_input_with_database(input: Input) -> Result<Result<ValidatedInput, InvalidInputError>, DatabaseError>;
Note that the Ok
parameter as shown in this example is optional, as it defaults to Ok
if unspecified.