pub struct AccessControl { /* private fields */ }Expand description
Per-rider access control: which stops the rider is allowed to visit.
When absent from a rider entity, the rider has unrestricted access.
When present, only stops in allowed_stops are
reachable — boarding is rejected with
RejectionReason::AccessDenied
if the rider’s current destination is not in the set.
Implementations§
Source§impl AccessControl
impl AccessControl
Sourcepub const fn new(allowed_stops: HashSet<EntityId>) -> Self
pub const fn new(allowed_stops: HashSet<EntityId>) -> Self
Create a new access control with the given set of allowed stops.
Sourcepub fn can_access(&self, stop: EntityId) -> bool
pub fn can_access(&self, stop: EntityId) -> bool
Check if the rider can access the given stop.
Sourcepub const fn allowed_stops(&self) -> &HashSet<EntityId>
pub const fn allowed_stops(&self) -> &HashSet<EntityId>
The set of allowed stop entity IDs.
Trait Implementations§
Source§impl Clone for AccessControl
impl Clone for AccessControl
Source§fn clone(&self) -> AccessControl
fn clone(&self) -> AccessControl
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AccessControl
impl Debug for AccessControl
Source§impl<'de> Deserialize<'de> for AccessControl
impl<'de> Deserialize<'de> for AccessControl
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AccessControl
impl RefUnwindSafe for AccessControl
impl Send for AccessControl
impl Sync for AccessControl
impl Unpin for AccessControl
impl UnsafeUnpin for AccessControl
impl UnwindSafe for AccessControl
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