Skip to contents

[Stable]

Calls fn() on the wrapped value of x if x is a Success, or Some, otherwise returns x if it is a Failure or Nothing.

This function can be used for control flow based on Result values.

Usage

and_then(x, fn, ...)

Arguments

x

A Result or Option object.

fn

A single argument function that accepts the unwrapped value of a Result or Option.

...

Additional optional arguments that may be used by specific methods.

See also