[−][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.
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:
- If
fisSomethen this functions formatserror_codeusingfwith the following format:
- {ErrorCategory::NAME}({error_code}): {<error_code as T>:?} - If
next_formatterisSome(index)then it returns the chained formatter of the associatedErrorCategoryindexed byindex. ASome(ErrorCodeFormatterVal)is returned ifindexis within bounds of the chainable categories (seeErrorCategory::chainable_category_formatters()). - This function addtionally always returns a
ErrorCategoryHandlethat represents the associatedErrorCategory.