#include "tensorstore/util/status_builder.h"
template <typename Adaptor>
auto tensorstore::StatusBuilder::With(
    
Adaptor&&
        
adaptor
) & -> decltype(std::forward<Adaptor>(adaptor)(*this));
template <typename Adaptor>
auto tensorstore::StatusBuilder::
    
With(Adaptor&adaptor) && -> decltype(std::forward<Adaptor>(
        
adaptor)(std::move(*this)));

Applies a custom adaptor functor to the StatusBuilder.

The adaptor functor can be any callable that takes a StatusBuilder or an absl::Status as an argument. The primary use cases are applying policies, type conversions, and/or side effects on the StatusBuilder, or converting the returned value of the TENSORSTORE_RETURN_IF_ERROR macro to another type.

Example:

return StatusBuilder(absl::StatusCode::kInvalidArgument)
     .Format("i=%d", i)
     .With([](absl::Status status) {
       LOG(ERROR) << "Error in FunctionWithLogging: " << status;
       return status;
     });
Returns:

The value returned by adaptor, which may be any type or void.