#[non_exhaustive]pub struct StatisticCategories {
pub redirect: bool,
pub basic: bool,
pub protocol: bool,
pub user_agent: bool,
}
Expand description
Which categories of statistics are to be collected
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.redirect: bool
Collect StatisticType::Request
basic: bool
§protocol: bool
§user_agent: bool
Collect StatisticType::UserAgent
,
StatisticType::UserAgentMobile
,
and StatisticType::UserAgentPlatform
Implementations§
Source§impl StatisticCategories
impl StatisticCategories
Sourcepub const fn specifies(self, stat_type: StatisticType) -> bool
pub const fn specifies(self, stat_type: StatisticType) -> bool
Whether this StatisticCategories
struct specifies that a statistic
with the provided StatisticType
should be collected
Sourcepub fn to_names(self) -> Vec<&'static str>
pub fn to_names(self) -> Vec<&'static str>
Convert this StatisticCategories
into a Vec
of the names of its
enabled categories
§Example
let mut categories = StatisticCategories::NONE;
categories.redirect = true;
categories.basic = false;
categories.protocol = true;
categories.user_agent = false;
assert_eq!(categories.to_names(), vec!["redirect", "protocol"]);
Sourcepub fn from_names<L, T>(categories: L) -> Self
pub fn from_names<L, T>(categories: L) -> Self
Convert a list of category names into a StatisticCategories
.
Unrecognized category names are ignored.
§Example
let list = ["redirect", "protocol", "invalid"];
let mut categories = StatisticCategories::from_names(list);
assert!(categories.redirect);
assert!(!categories.basic);
assert!(categories.protocol);
assert!(!categories.user_agent);
Trait Implementations§
Source§impl Clone for StatisticCategories
impl Clone for StatisticCategories
Source§fn clone(&self) -> StatisticCategories
fn clone(&self) -> StatisticCategories
Returns a copy 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 StatisticCategories
impl Debug for StatisticCategories
Source§impl Default for StatisticCategories
impl Default for StatisticCategories
Source§impl<'de> Deserialize<'de> for StatisticCategories
impl<'de> Deserialize<'de> for StatisticCategories
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
Source§impl From<StatisticCategories> for Vec<&'static str>
impl From<StatisticCategories> for Vec<&'static str>
Source§fn from(cats: StatisticCategories) -> Self
fn from(cats: StatisticCategories) -> Self
Converts to this type from the input type.
Source§impl PartialEq for StatisticCategories
impl PartialEq for StatisticCategories
Source§impl Serialize for StatisticCategories
impl Serialize for StatisticCategories
impl Copy for StatisticCategories
impl Eq for StatisticCategories
impl StructuralPartialEq for StatisticCategories
Auto Trait Implementations§
impl Freeze for StatisticCategories
impl RefUnwindSafe for StatisticCategories
impl Send for StatisticCategories
impl Sync for StatisticCategories
impl Unpin for StatisticCategories
impl UnwindSafe for StatisticCategories
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request