Skip to main content

DynPolicy

Trait DynPolicy 

pub trait DynPolicy<P>:
    Debug
    + Send
    + Sync
    + 'static
where P: PeerId,
{ // Required method fn decide<'a>( &'a self, request: &'a PeerRequest<P>, ) -> Pin<Box<dyn Future<Output = Result<Authorization, Rejection>> + 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§

fn decide<'a>( &'a self, request: &'a PeerRequest<P>, ) -> Pin<Box<dyn Future<Output = Result<Authorization, Rejection>> + 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§

§

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