pub enum MessagePriority {
Low = 0,
Normal = 1,
High = 2,
Critical = 3,
}Expand description
Message priority levels
Variants§
Low = 0
Low priority - status updates, periodic beacons
Normal = 1
Normal priority - standard operations
High = 2
High priority - important state changes
Critical = 3
Critical priority - leader election, emergencies
Implementations§
Source§impl MessagePriority
impl MessagePriority
Sourcepub fn escalate(self, context: RoutingContext) -> Self
pub fn escalate(self, context: RoutingContext) -> Self
Escalate priority when crossing hierarchy boundaries
§Priority Escalation Rules
-
Cell → Zone (Upward): All messages escalate +1 level (max: Critical)
- Rationale: Zone coordinator processes fewer, more important messages
- Low → Normal, Normal → High, High → Critical, Critical → Critical
-
Zone → Cell (Downward): No escalation (maintain priority)
- Rationale: Zone directives already have appropriate priority
-
Intra-Cell/Intra-Zone: No escalation (lateral communication)
§Examples
use peat_protocol::cell::messaging::{MessagePriority, RoutingContext};
let priority = MessagePriority::Normal;
// Escalates when going up the hierarchy
assert_eq!(
priority.escalate(RoutingContext::CellToZone),
MessagePriority::High
);
// No escalation for lateral or downward routing
assert_eq!(
priority.escalate(RoutingContext::IntraCell),
MessagePriority::Normal
);Sourcepub fn can_preempt(self, other: MessagePriority) -> bool
pub fn can_preempt(self, other: MessagePriority) -> bool
Determine if this priority should preempt lower priority messages
Used for flow control and queue management decisions.
Sourcepub fn bandwidth_multiplier(self) -> f32
pub fn bandwidth_multiplier(self) -> f32
Get the numeric value for bandwidth allocation
Higher priorities get more bandwidth allocation in flow control. Returns a multiplier for bandwidth limits (1.0 = normal, 2.0 = double bandwidth, etc.)
Trait Implementations§
Source§impl Clone for MessagePriority
impl Clone for MessagePriority
Source§fn clone(&self) -> MessagePriority
fn clone(&self) -> MessagePriority
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessagePriority
impl Debug for MessagePriority
Source§impl Default for MessagePriority
impl Default for MessagePriority
Source§fn default() -> MessagePriority
fn default() -> MessagePriority
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MessagePriority
impl<'de> Deserialize<'de> for MessagePriority
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<MessagePriority> for QoSClass
impl From<MessagePriority> for QoSClass
Source§fn from(priority: MessagePriority) -> Self
fn from(priority: MessagePriority) -> Self
Converts to this type from the input type.
Source§impl From<QoSClass> for MessagePriority
impl From<QoSClass> for MessagePriority
Source§impl Ord for MessagePriority
impl Ord for MessagePriority
Source§fn cmp(&self, other: &MessagePriority) -> Ordering
fn cmp(&self, other: &MessagePriority) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for MessagePriority
impl PartialEq for MessagePriority
Source§impl PartialOrd for MessagePriority
impl PartialOrd for MessagePriority
Source§impl Serialize for MessagePriority
impl Serialize for MessagePriority
impl Copy for MessagePriority
impl Eq for MessagePriority
impl StructuralPartialEq for MessagePriority
Auto Trait Implementations§
impl Freeze for MessagePriority
impl RefUnwindSafe for MessagePriority
impl Send for MessagePriority
impl Sync for MessagePriority
impl Unpin for MessagePriority
impl UnsafeUnpin for MessagePriority
impl UnwindSafe for MessagePriority
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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