[][src]Type Definition embedded_error_chain::ErrorCodeFormatter

type ErrorCodeFormatter = fn(error_code: ErrorCode, next_formatter: Option<u8>, f: Option<&mut Formatter<'_>>) -> (ErrorCategoryHandle, Result<Option<ErrorCodeFormatterVal>, Error>);

A chained formatter function for a single error category.

A single ErrorCodeFormatter function is considered to be uniquely associated with a type that implements ErrorCategory. Meaning one such function only ever returns the ErrorCategoryHandle for that associated ErrorCategory, and never for another.

This function serves multiple purposes:

  1. If f is Some then this functions formats error_code using f.
  2. If next_formatter is Some(index) then it returns the chained formatter of the associated ErrorCategory indexed by index. A Some(ErrorCodeFormatterVal) is returned if index is within bounds of the chainable categories (see ErrorCategory::chainable_category_formatters()).
  3. This function additionally always returns a ErrorCategoryHandle that represents the associated ErrorCategory.