pub struct InterestSet<K, S = RandomState> {
    pub observed: HashSet<K, S>,
    pub filtered: HashSet<K, S>,
}
Expand description

Description for a handler that describes what event kinds are interesting to the handler.

This can be useful if you can filter events before they are passed to dptree. In this case you should keep updates that are in the observed set.

Fields

observed: HashSet<K, S>

Event kinds that are of interested for a given handler.

I.e. the ones that can cause meaningful side-effects.

filtered: HashSet<K, S>

Event kinds that can be observed by handlers chained to this one.

Implementations

Constructs an InterestSet for a filter that allows to pass through it only updates with kinds in the filtered set.

Note that the filter should not have observable side-effects, for example:

use dptree::{description::{InterestSet, EventKind}, filter_with_description};
use maplit::hashset;

filter_with_description(InterestSet::new_filter(hashset! {}), || {
    println!("Filter called!"); // <-- bad

    false
});

filter_with_description(InterestSet::new_filter(hashset! {}), |db: Db| {
    let pass = db.fetch_enabled(); // <-- fine

    pass
});

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Description for entry.

Description for a user-defined handler that can do practically everything. Read more

Description for endpoint. Read more

Merge descriptions to get a description for a chain handler.

Merge descriptions to get a description for a branch handler.

Description for map. Read more

Description for map_async. Read more

Description for filter. Read more

Description for filter_async. Read more

Description for filter_map. Read more

Description for filter_map_async. Read more

Description for inspect. Read more

Description for inspect_async. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.