#[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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more