pub struct Requirement {
pub access: Access,
pub scope: Scope,
pub all: Permissions,
pub any: Permissions,
pub others: Option<Permissions>,
pub conditional: Permissions,
pub not_timed_out: bool,
pub not_waiting: bool,
pub reserved: bool,
}Expand description
What a command requires (permissions §6, specification §8).
Fields§
§access: AccessWho may send it.
scope: ScopeWhere the bits are evaluated.
all: PermissionsBits that must all be effective.
any: PermissionsWhen non-empty, at least one of these must be effective as well.
others: Option<Permissions>When acting on another member’s object (message, reaction, nickname, invitation,
report), these bits replace all.
conditional: PermissionsBits needed only for some bodies: the engine passes the ones that apply (attachments, links, a new emoji, a pre-approved invitation, a channel stream, a full record).
not_timed_out: boolRefused with TIMED_OUT while timed out, even when the bits survive the timeout.
not_waiting: boolRefused with FORBIDDEN{reason:"probation"} during the waiting period.
reserved: boolReserved (P1/P2): a v1 host answers UNSUPPORTED_FEATURE before any check.
Implementations§
Source§impl Requirement
impl Requirement
Sourcepub const fn bits(scope: Scope, all: Permissions) -> Self
pub const fn bits(scope: Scope, all: Permissions) -> Self
A member command needing all in scope.
Sourcepub fn check(
&self,
resolved: &Resolved,
other: bool,
conditional: Permissions,
) -> Result<(), Denial>
pub fn check( &self, resolved: &Resolved, other: bool, conditional: Permissions, ) -> Result<(), Denial>
Checks the resolved permissions in the requirement’s scope. other is true when the
actor acts on another member’s object; conditional holds the conditional bits the
body needs (masked by Requirement::conditional).
Trait Implementations§
Source§impl Clone for Requirement
impl Clone for Requirement
Source§fn clone(&self) -> Requirement
fn clone(&self) -> Requirement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more