AttachAuthorities

Trait AttachAuthorities 

Source
pub trait AttachAuthorities<Type> {
    // Required method
    fn attach(&mut self, authorities: impl IntoIterator<Item = Type>);
}
Expand description

Allows you to transfer authorities to a web framework.

§Example

use std::collections::HashSet;

// You can use you own type/enum instead of `String`
fn handle(req: &Request) {
    let authorities: HashSet<String> = ...;
    req.attach(authorities);
}

Required Methods§

Source

fn attach(&mut self, authorities: impl IntoIterator<Item = Type>)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<Type, Body> AttachAuthorities<Type> for Request<Body>
where Type: Eq + Hash + Send + Sync + 'static,

Source§

fn attach(&mut self, authorities: impl IntoIterator<Item = Type>)

Implementors§