#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct DispatchQos {
pub qos_class: DispatchQosClass,
pub relative_priority: i32,
}
impl Default for DispatchQos {
#[inline]
fn default() -> Self {
Self::DEFAULT
}
}
impl DispatchQos {
pub const INTERACTIVE: Self = Self::new(DispatchQosClass::Interactive, 0);
pub const USER_INITIATED: Self = Self::new(DispatchQosClass::UserInitiated, 0);
pub const DEFAULT: Self = Self::new(DispatchQosClass::Default, 0);
pub const UTILITY: Self = Self::new(DispatchQosClass::Utility, 0);
pub const BACKGROUND: Self = Self::new(DispatchQosClass::Background, 0);
pub const UNSPECIFIED: Self = Self::new(DispatchQosClass::Unspecified, 0);
#[inline]
pub const fn new(qos_class: DispatchQosClass, relative_priority: i32) -> Self {
Self {
qos_class,
relative_priority,
}
}
#[inline]
pub const fn with_qos_class(self, qos_class: DispatchQosClass) -> Self {
Self { qos_class, ..self }
}
#[inline]
pub const fn with_relative_priority(self, relative_priority: i32) -> Self {
Self {
relative_priority,
..self
}
}
}
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[repr(u32)] pub enum DispatchQosClass {
Interactive = 0x21,
UserInitiated = 0x19,
Default = 0x15,
Utility = 0x11,
Background = 0x09,
Unspecified = 0x00,
}
impl Default for DispatchQosClass {
#[inline]
fn default() -> Self {
Self::Default
}
}