Skip to main content

PeekPolicyProvider

Trait PeekPolicyProvider 

pub trait PeekPolicyProvider<Input>:
    Send
    + Sync
    + 'static {
    // Required method
    fn peek_policy(&self, input: &Input) -> PeekPolicy;
}
Available on crate feature std only.
Expand description

Selects the PeekPolicy a peeker applies to one input.

Configured on a single peeker, so it affects only that peeker. It is implemented for a static PeekPolicy and for Fn(&Input) -> PeekPolicy closures; implement it for a type of your own to reuse one selection across peekers that see different input types.

Required Methods§

fn peek_policy(&self, input: &Input) -> PeekPolicy

The PeekPolicy to apply while peeking input.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl<Input, F> PeekPolicyProvider<Input> for F
where F: Fn(&Input) -> PeekPolicy + Send + Sync + 'static,

§

impl<Input> PeekPolicyProvider<Input> for PeekPolicy