Struct carapax::access::AccessRule
source · pub struct AccessRule { /* private fields */ }
Available on crate feature
access
only.Expand description
Represents an access rule containing information about a principal and access grant status.
Implementations§
source§impl AccessRule
impl AccessRule
sourcepub fn new<T>(principal: T, is_granted: bool) -> Self
pub fn new<T>(principal: T, is_granted: bool) -> Self
Creates a new AccessRule
.
§Arguments
principal
- A principal.is_granted
- A flag indicating whether access is granted (true
) or denied (false
).
sourcepub fn allow_user<T>(value: T) -> Self
pub fn allow_user<T>(value: T) -> Self
Creates a new AccessRule
with granted access for a specific user.
§Arguments
value
- Identifier of the user.
sourcepub fn deny_user<T>(value: T) -> Self
pub fn deny_user<T>(value: T) -> Self
Creates a new AccessRule
with denied access for a specific user.
§Arguments
value
- Identifier of the user.
sourcepub fn allow_chat<T>(value: T) -> Self
pub fn allow_chat<T>(value: T) -> Self
Creates a new AccessRule
with granted access for a specific chat.
§Arguments
value
- Identifier of the chat.
sourcepub fn deny_chat<T>(value: T) -> Self
pub fn deny_chat<T>(value: T) -> Self
Creates a new AccessRule
with denied access for a specific chat.
§Arguments
value
- Identifier of the chat.
sourcepub fn allow_chat_user<A, B>(chat_id: A, user_id: B) -> Self
pub fn allow_chat_user<A, B>(chat_id: A, user_id: B) -> Self
Creates a new AccessRule
with granted access for a user within a specific chat.
§Arguments
chat_id
- Identifier of the chat.user_id
- Identifier of the user.
sourcepub fn deny_chat_user<A, B>(chat_id: A, user_id: B) -> Self
pub fn deny_chat_user<A, B>(chat_id: A, user_id: B) -> Self
Creates a new AccessRule
with denied access for a user within a specific chat.
§Arguments
chat_id
- Identifier of the chat.user_id
- Identifier of the user.
sourcepub fn is_granted(&self) -> bool
pub fn is_granted(&self) -> bool
Indicates whether access is granted by the rule.
Returns true
if access is granted and false
otherwise.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AccessRule
impl RefUnwindSafe for AccessRule
impl Send for AccessRule
impl Sync for AccessRule
impl Unpin for AccessRule
impl UnwindSafe for AccessRule
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more