Skip to content

Struct permissions::Requirement

zaun_community_protocol::permissions::Requirement · Struct

pub struct Requirement { … }

What a command requires (permissions the protocol, the protocol).

Who may send it.

Where the bits are evaluated.

Bits that must all be effective.

When non-empty, at least one of these must be effective as well.

When acting on another member’s object (message, reaction, nickname, invitation, report), these bits replace all.

Bits 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).

Refused with TIMED_OUT while timed out, even when the bits survive the timeout.

Refused with FORBIDDEN{reason:"probation"} during the waiting period.

Reserved (P1/P2): a v1 host answers UNSUPPORTED_FEATURE before any check.

pub const fn access(access: Access) -> Self

A row with no bits.

pub const fn bits(scope: Scope, all: Permissions) -> Self

A member command needing all in scope.

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

Clone, Copy, Debug, Eq, Hash, PartialEq, StructuralPartialEq

Full rustdoc page