pub struct HeaderRoleExtractor { /* private fields */ }Expand description
Extract roles bitmask from an HTTP header.
The header value is parsed as a u32 bitmask directly, or you can use a custom parser function to convert header values to bitmasks.
§Example
use axum_acl::HeaderRoleExtractor;
// Extract roles bitmask directly from X-Roles header (as decimal or hex)
let extractor = HeaderRoleExtractor::new("X-Roles");
// With a custom default roles bitmask for missing headers
let extractor = HeaderRoleExtractor::new("X-Roles")
.with_default_roles(0b100); // guest roleImplementations§
Trait Implementations§
Source§impl Clone for HeaderRoleExtractor
impl Clone for HeaderRoleExtractor
Source§fn clone(&self) -> HeaderRoleExtractor
fn clone(&self) -> HeaderRoleExtractor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HeaderRoleExtractor
impl Debug for HeaderRoleExtractor
Source§impl<B> RoleExtractor<B> for HeaderRoleExtractor
impl<B> RoleExtractor<B> for HeaderRoleExtractor
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 Freeze for HeaderRoleExtractor
impl RefUnwindSafe for HeaderRoleExtractor
impl Send for HeaderRoleExtractor
impl Sync for HeaderRoleExtractor
impl Unpin for HeaderRoleExtractor
impl UnwindSafe for HeaderRoleExtractor
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