Struct LevelFilter

struct LevelFilter(_)

A filter comparable to a verbosity Level.

If a Level is considered less than or equal to a LevelFilter, it should be considered enabled; if greater than the LevelFilter, that level is disabled. See LevelFilter::current for more details.

Note that this is essentially identical to the Level type, but with the addition of an OFF level that completely disables all trace instrumentation.

See the documentation for the Level type to see how Levels and LevelFilters interact.

Implementations

impl LevelFilter

const fn from_level(level: Level) -> Self

Returns a LevelFilter that enables spans and events with verbosity up to and including level.

const fn into_level(self: Self) -> Option<Level>

Returns the most verbose Level that this filter accepts, or None if it is OFF.

fn current() -> Self

Returns a LevelFilter that matches the most verbose Level that any currently active Subscriber will enable.

User code should treat this as a hint. If a given span or event has a level higher than the returned LevelFilter, it will not be enabled. However, if the level is less than or equal to this value, the span or event is not guaranteed to be enabled; the subscriber will still filter each callsite individually.

Therefore, comparing a given span or event's level to the returned LevelFilter can be used for determining if something is disabled, but should not be used for determining if something is enabled.

impl Clone for LevelFilter

fn clone(self: &Self) -> LevelFilter

impl Copy for LevelFilter

impl Debug for LevelFilter

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

impl Display for LevelFilter

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

impl Eq for LevelFilter

impl Freeze for LevelFilter

impl From for LevelFilter

fn from(level: Level) -> Self

impl From for LevelFilter

fn from(level: Option<Level>) -> Self

impl FromStr for LevelFilter

fn from_str(from: &str) -> Result<Self, <Self as >::Err>

impl Hash for LevelFilter

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl Ord for LevelFilter

fn cmp(self: &Self, other: &Self) -> Ordering

impl PartialEq for LevelFilter

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

impl PartialEq for LevelFilter

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

impl PartialOrd for LevelFilter

fn partial_cmp(self: &Self, other: &LevelFilter) -> Option<Ordering>
fn lt(self: &Self, other: &LevelFilter) -> bool
fn le(self: &Self, other: &LevelFilter) -> bool
fn gt(self: &Self, other: &LevelFilter) -> bool
fn ge(self: &Self, other: &LevelFilter) -> bool

impl PartialOrd for LevelFilter

fn partial_cmp(self: &Self, other: &Level) -> Option<Ordering>
fn lt(self: &Self, other: &Level) -> bool
fn le(self: &Self, other: &Level) -> bool
fn gt(self: &Self, other: &Level) -> bool
fn ge(self: &Self, other: &Level) -> bool

impl RefUnwindSafe for LevelFilter

impl Send for LevelFilter

impl StructuralPartialEq for LevelFilter

impl Sync for LevelFilter

impl Unpin for LevelFilter

impl UnsafeUnpin for LevelFilter

impl UnwindSafe for LevelFilter

impl<T> Any for LevelFilter

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for LevelFilter

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for LevelFilter

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

impl<T> CloneToUninit for LevelFilter

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for LevelFilter

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for LevelFilter

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for LevelFilter

fn to_string(self: &Self) -> String

impl<T, U> Into for LevelFilter

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for LevelFilter

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

impl<T, U> TryInto for LevelFilter

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