Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_format
  5. FormatError

FormatError

Trait FormatError 

Source
pub trait FormatError {
    type Error;

    // Required methods
    fn format_error(&self, spec: &ConversionSpec, error: &Self::Error) -> String;
    fn format_missing(&self, spec: &ConversionSpec) -> String;
    fn format_type_error(&self, spec: &ConversionSpec, arg: &Arg) -> String;

    // Provided methods
    fn format_nested_token_error(
        &self,
        spec: &NestedTokenSpec,
        _error: &Self::Error,
    ) -> String { ... }
    fn format_nested_token_missing(&self, spec: &NestedTokenSpec) -> String { ... }
    fn format_nested_token_type_error(
        &self,
        spec: &NestedTokenSpec,
        _arg: &Arg,
    ) -> String { ... }
}
Expand description

A trait for formatting conversion specifiers that failed, were skipped, or were missing.

Required Associated Types§

Source

type Error

The domain-specific error type.

Required Methods§

Source

fn format_error(&self, spec: &ConversionSpec, error: &Self::Error) -> String

Renders a conversion specifier that failed with a domain-specific error.

Source

fn format_missing(&self, spec: &ConversionSpec) -> String

Renders a conversion specifier that was missing from the supplied arguments.

Source

fn format_type_error(&self, spec: &ConversionSpec, arg: &Arg) -> String

Renders a conversion specifier that decoded successfully but failed to format (type mismatch).

Provided Methods§

Source

fn format_nested_token_error( &self, spec: &NestedTokenSpec, _error: &Self::Error, ) -> String

Renders a nested token specification that failed with a domain-specific error.

Source

fn format_nested_token_missing(&self, spec: &NestedTokenSpec) -> String

Renders a nested token specification that was missing from the supplied arguments.

Source

fn format_nested_token_type_error( &self, spec: &NestedTokenSpec, _arg: &Arg, ) -> String

Renders a nested token specification that decoded successfully but failed to format (type mismatch).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§