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§
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.