[−][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:
- If
f
isSome
then this functions formatserror_code
usingf
. - If
next_formatter
isSome(index)
then it returns the chained formatter of the associatedErrorCategory
indexed byindex
. ASome(
ErrorCodeFormatterVal
)
is returned ifindex
is within bounds of the chainable categories (seeErrorCategory::chainable_category_formatters()
). - This function additionally always returns a
ErrorCategoryHandle
that represents the associatedErrorCategory
.