Struct stakker::LogFilter

source ·
pub struct LogFilter(_);
Expand description

Filter for logging levels

This is a “copy” value which represents a set of enabled logging levels. Filters can be combined using the | and |= bit-or operators. A filter can be generated from a LogLevel using LogFilter::from. Note that converting from a LogLevel will also enable any related levels – see LogFilter::from documentation.

Implementations§

source§

impl LogFilter

source

pub fn new() -> Self

Return a LogFilter with no levels enabled

source

pub fn all(levels: &[LogLevel]) -> Self

Return a LogFilter with all the listed levels enabled, as converted by LogFilter::from.

source

pub fn allows(&self, level: LogLevel) -> bool

Test whether the given LogLevel is enabled

source

pub fn is_empty(&self) -> bool

Test whether the set of enabled levels is empty

Trait Implementations§

source§

impl BitOr<LogFilter> for LogFilter

§

type Output = LogFilter

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
source§

impl BitOrAssign<LogFilter> for LogFilter

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl Clone for LogFilter

source§

fn clone(&self) -> LogFilter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LogFilter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for LogFilter

source§

fn default() -> LogFilter

Returns the “default value” for a type. Read more
source§

impl Display for LogFilter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<LogLevel> for LogFilter

source§

fn from(level: LogLevel) -> Self

Convert a LogLevel into a LogFilter. Where a severity level (LogLevel::Trace to LogLevel::Error) is passed, all higher severity levels are also enabled. Where LogLevel::Open or LogLevel::Close is passed, the other is also enabled. LogLevel::Audit only enables itself. LogLevel::Off gives no levels enabled.

source§

impl FromStr for LogFilter

§

type Err = LogLevelError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<LogFilter, LogLevelError>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq<LogFilter> for LogFilter

source§

fn eq(&self, other: &LogFilter) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for LogFilter

source§

impl Eq for LogFilter

source§

impl StructuralEq for LogFilter

source§

impl StructuralPartialEq for LogFilter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.