Dedup

Trait Dedup 

Source
pub trait Dedup: Display {
    type ID: Hash + Eq + Send + Sync + 'static;

    // Required method
    fn identify(&self) -> Self::ID;

    // Provided method
    fn cooldown(&self) -> Duration { ... }
}
Expand description

An error type with a cooldown and a category.

This is used by Log to avoid repetitively logging the same error. This avoids spamming errors in the console.

Required Associated Types§

Source

type ID: Hash + Eq + Send + Sync + 'static

Used to de-duplicate identical messages to avoid spamming the log.

Required Methods§

Source

fn identify(&self) -> Self::ID

What constitutes “distinct” error types.

Provided Methods§

Source

fn cooldown(&self) -> Duration

How long an error must not be produced in order to be displayed again.

This controls when Log returns an error.

If it returns Duration::ZERO, Log will print the error each time it is emitted, acting like LogSimply.

Implementations on Foreign Types§

Source§

impl Dedup for &'static str

Source§

type ID = &'static str

Source§

fn identify(&self) -> Self

Source§

impl Dedup for Box<dyn Error>

Source§

fn identify(&self)

By default, only print a single error per system.

Source§

type ID = ()

Source§

impl Dedup for Error

Source§

fn identify(&self)

By default, only print a single error per system.

Source§

type ID = ()

Implementors§