Skip to main content

DynPolicy

Trait DynPolicy 

Source
pub trait DynPolicy<P: PeerId>:
    Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn decide<'a>(
        &'a self,
        request: &'a PeerRequest<P>,
    ) -> Pin<Box<dyn Future<Output = Decision> + Send + 'a>>;
}
Expand description

A Policy with its type erased, as a node stores it.

Arc<dyn DynPolicy<P>> implements Policy. Implement Policy, not this trait.

Required Methods§

Source

fn decide<'a>( &'a self, request: &'a PeerRequest<P>, ) -> Pin<Box<dyn Future<Output = Decision> + Send + 'a>>

Decides as Policy::decide does, with a boxed future.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<P: PeerId, T: Policy<P>> DynPolicy<P> for T