pub struct AccessList { /* private fields */ }Expand description
Access control list for a site.
Implementations§
Source§impl AccessList
impl AccessList
Sourcepub fn add_rule(&mut self, rule: AccessRule)
pub fn add_rule(&mut self, rule: AccessRule)
Adds a rule to the access list.
Sourcepub fn allow(&mut self, cidr: &str) -> Result<(), AccessError>
pub fn allow(&mut self, cidr: &str) -> Result<(), AccessError>
Adds an allow rule for the given CIDR.
Sourcepub fn deny(&mut self, cidr: &str) -> Result<(), AccessError>
pub fn deny(&mut self, cidr: &str) -> Result<(), AccessError>
Adds a deny rule for the given CIDR.
Sourcepub fn set_default(&mut self, action: AccessAction)
pub fn set_default(&mut self, action: AccessAction)
Sets the default action.
Sourcepub fn check(&self, ip: &IpAddr) -> AccessDecision
pub fn check(&self, ip: &IpAddr) -> AccessDecision
Checks if an IP address is allowed.
Sourcepub fn is_allowed(&self, ip: &IpAddr) -> bool
pub fn is_allowed(&self, ip: &IpAddr) -> bool
Returns true if the IP is allowed.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Returns the number of rules.
Trait Implementations§
Source§impl Debug for AccessList
impl Debug for AccessList
Source§impl Default for AccessList
impl Default for AccessList
Source§fn default() -> AccessList
fn default() -> AccessList
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AccessList
impl RefUnwindSafe for AccessList
impl Send for AccessList
impl Sync for AccessList
impl Unpin for AccessList
impl UnsafeUnpin for AccessList
impl UnwindSafe for AccessList
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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