pub struct ExtensionRoleExtractor<T> { /* private fields */ }Expand description
Extract roles from a request extension.
This extractor looks for roles that were set by a previous middleware (e.g., an authentication middleware) as a request extension.
§Example
use axum_acl::ExtensionRoleExtractor;
// The authentication middleware should insert a Roles struct into extensions
#[derive(Clone)]
struct UserRoles(u32);
let extractor = ExtensionRoleExtractor::<UserRoles>::new(|roles| roles.0);Implementations§
Trait Implementations§
Source§impl<T> Debug for ExtensionRoleExtractor<T>
impl<T> Debug for ExtensionRoleExtractor<T>
Source§impl<B, T: Clone + Send + Sync + 'static> RoleExtractor<B> for ExtensionRoleExtractor<T>
impl<B, T: Clone + Send + Sync + 'static> RoleExtractor<B> for ExtensionRoleExtractor<T>
Source§fn extract_roles(&self, request: &Request<B>) -> RoleExtractionResult
fn extract_roles(&self, request: &Request<B>) -> RoleExtractionResult
Extract the roles bitmask from an HTTP request.
Auto Trait Implementations§
impl<T> Freeze for ExtensionRoleExtractor<T>
impl<T> !RefUnwindSafe for ExtensionRoleExtractor<T>
impl<T> Send for ExtensionRoleExtractor<T>
impl<T> Sync for ExtensionRoleExtractor<T>
impl<T> Unpin for ExtensionRoleExtractor<T>
impl<T> !UnwindSafe for ExtensionRoleExtractor<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more