Skip to main content

RoleName

Trait RoleName 

Source
pub trait RoleName:
    Send
    + Sync
    + 'static {
    const ROLE: &'static str;
}
Expand description

Map a zero-sized type to a role name (see RequireRole).

struct Admin;
impl RoleName for Admin {
    const ROLE: &'static str = "admin";
}

async fn admin_only(_: RequireRole<Admin>) -> ApiResponse<()> {
    ApiResponse::ok(())
}

Required Associated Constants§

Source

const ROLE: &'static str

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.

Implementors§