#[repr(i8)]pub enum CategoryUnit {
Count = 0,
Bytes = 1,
Milliseconds = 2,
}Expand description
The unit in which a data category is measured.
This enum specifies how quantities for different data categories are measured, which affects how quota limits are interpreted and enforced.
Note: There is no Unknown variant. For categories without a defined unit
(e.g., DataCategory::Unknown), methods return Option::None.
Variants§
Count = 0
Counts the number of discrete items.
Bytes = 1
Counts the number of bytes across items.
Milliseconds = 2
Counts the accumulated time in milliseconds across items.
Implementations§
Source§impl CategoryUnit
impl CategoryUnit
Sourcepub fn from_name(string: &str) -> Option<Self>
pub fn from_name(string: &str) -> Option<Self>
Returns the category unit corresponding to the given name string.
Returns None if the string doesn’t match any known unit.
Sourcepub fn from_category(category: DataCategory) -> Option<Self>
pub fn from_category(category: DataCategory) -> Option<Self>
Returns the CategoryUnit for the given DataCategory.
Returns None for DataCategory::Unknown.
Note: Takes a reference to avoid unnecessary copying and allow direct use with iterators.
Trait Implementations§
Source§impl Clone for CategoryUnit
impl Clone for CategoryUnit
Source§fn clone(&self) -> CategoryUnit
fn clone(&self) -> CategoryUnit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CategoryUnit
impl Debug for CategoryUnit
Source§impl<'de> Deserialize<'de> for CategoryUnit
impl<'de> Deserialize<'de> for CategoryUnit
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>,
Source§impl Display for CategoryUnit
impl Display for CategoryUnit
Source§impl FromStr for CategoryUnit
impl FromStr for CategoryUnit
Source§impl Hash for CategoryUnit
impl Hash for CategoryUnit
Source§impl PartialEq for CategoryUnit
impl PartialEq for CategoryUnit
Source§fn eq(&self, other: &CategoryUnit) -> bool
fn eq(&self, other: &CategoryUnit) -> bool
self and other values to be equal, and is used by ==.