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 CRITICAL: Priority
pub const CRITICAL: Priority
Critical priority - for essential data (IDs, status, core metadata)
Sourcepub const BACKGROUND: Priority
pub const BACKGROUND: Priority
Background priority - for analytics, logs, etc.
Sourcepub fn increase_by(self, delta: u8) -> Priority
pub fn increase_by(self, delta: u8) -> Priority
Increase priority by delta (saturating at max)
Sourcepub fn decrease_by(self, delta: u8) -> Priority
pub fn decrease_by(self, delta: u8) -> Priority
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) -> Result<Priority, DomainError>
pub fn from_percentage(percent: f32) -> Result<Priority, DomainError>
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<Priority, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Priority, <__D as Deserializer<'de>>::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 Serialize for Priority
impl Serialize for Priority
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more