pub enum MessagePriority {
Low,
Normal,
High,
}Expand description
Message priority levels.
§Examples
use pmcp::shared::transport::MessagePriority;
// Priority levels are ordered
assert!(MessagePriority::Low < MessagePriority::Normal);
assert!(MessagePriority::Normal < MessagePriority::High);
// Default is Normal
let default_priority = MessagePriority::default();
assert_eq!(default_priority, MessagePriority::Normal);
// Use in message queue prioritization
let mut messages = vec![
("msg1", MessagePriority::Low),
("msg2", MessagePriority::High),
("msg3", MessagePriority::Normal),
];
// Sort by priority (highest first)
messages.sort_by_key(|(_, priority)| std::cmp::Reverse(*priority));
assert_eq!(messages[0].0, "msg2"); // High priority first
assert_eq!(messages[1].0, "msg3"); // Normal priority second
assert_eq!(messages[2].0, "msg1"); // Low priority lastVariants§
Trait Implementations§
Source§impl Clone for MessagePriority
impl Clone for MessagePriority
impl Copy for MessagePriority
Source§impl Debug for MessagePriority
impl Debug for MessagePriority
Source§impl Default for MessagePriority
impl Default for MessagePriority
impl Eq for MessagePriority
Source§impl Ord for MessagePriority
impl Ord for MessagePriority
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for MessagePriority
impl PartialEq for MessagePriority
Source§impl PartialOrd for MessagePriority
impl PartialOrd 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.