pub struct Priority(/* private fields */);
Expand description
Type-safe priority value (1-255 range)
This is a pure domain object. Serialization should be handled in the application layer via DTOs, but serde is temporarily kept for compatibility with existing code.
TODO: Remove Serialize, Deserialize derives once all serialization uses DTOs
Implementations§
Source§impl Priority
impl Priority
Sourcepub const BACKGROUND: Self
pub const BACKGROUND: Self
Background priority - for analytics, logs, etc.
Sourcepub fn new(value: u8) -> DomainResult<Self>
pub fn new(value: u8) -> DomainResult<Self>
Create priority with validation
Sourcepub fn increase_by(self, delta: u8) -> Self
pub fn increase_by(self, delta: u8) -> Self
Increase priority by delta (saturating at max)
Sourcepub fn decrease_by(self, delta: u8) -> Self
pub fn decrease_by(self, delta: u8) -> Self
Decrease priority by delta (saturating at min)
Sourcepub fn is_critical(self) -> bool
pub fn is_critical(self) -> bool
Check if this is a critical priority
Sourcepub fn is_high_or_above(self) -> bool
pub fn is_high_or_above(self) -> bool
Check if this is high priority or above
Sourcepub fn from_percentage(percent: f32) -> DomainResult<Self>
pub fn from_percentage(percent: f32) -> DomainResult<Self>
Create priority from percentage (0-100)
Sourcepub fn to_percentage(self) -> f32
pub fn to_percentage(self) -> f32
Convert to percentage (0-100)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Priority
impl<'de> Deserialize<'de> for Priority
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<Priority> for PriorityDto
impl From<Priority> for PriorityDto
Source§impl FromDto<PriorityDto> for Priority
impl FromDto<PriorityDto> for Priority
type Error = DomainError
fn from_dto(dto: PriorityDto) -> Result<Self, Self::Error>
Source§impl Ord for Priority
impl Ord for Priority
Source§impl PartialOrd for Priority
impl PartialOrd for Priority
Source§impl ToDto<PriorityDto> for Priority
impl ToDto<PriorityDto> for Priority
fn to_dto(self) -> PriorityDto
Source§impl TryFrom<PriorityDto> for Priority
impl TryFrom<PriorityDto> for Priority
Source§type Error = DomainError
type Error = DomainError
The type returned in the event of a conversion error.
impl Copy for Priority
impl Eq for Priority
impl StructuralPartialEq for Priority
Auto Trait Implementations§
impl Freeze for Priority
impl RefUnwindSafe for Priority
impl Send for Priority
impl Sync for Priority
impl Unpin for Priority
impl UnwindSafe for Priority
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.