pub enum QueueOverflowPolicy {
DropOldest,
DropNewest,
Block {
timeout: Duration,
},
}Expand description
Queue overflow handling policy
Determines how the queue behaves when it reaches capacity.
§Default
The default policy is DropOldest, which is suitable for real-time
monitoring scenarios where the latest data is most important.
§Example
use canlink_hal::queue::QueueOverflowPolicy;
use std::time::Duration;
// Default policy
let policy = QueueOverflowPolicy::default();
assert!(matches!(policy, QueueOverflowPolicy::DropOldest));
// Block with timeout
let policy = QueueOverflowPolicy::Block {
timeout: Duration::from_millis(100),
};Variants§
DropOldest
Drop the oldest message in the queue
This is the default policy, suitable for real-time monitoring where the latest data is most important.
DropNewest
Drop the newest message (the one being added)
Suitable for data recording scenarios where preserving complete history is important.
Block
Block until space is available or timeout expires
Suitable for critical messages that should not be lost.
Returns QueueError::QueueFull if timeout expires.
Implementations§
Source§impl QueueOverflowPolicy
impl QueueOverflowPolicy
Sourcepub fn drop_oldest() -> Self
pub fn drop_oldest() -> Self
Create a new DropOldest policy
Sourcepub fn drop_newest() -> Self
pub fn drop_newest() -> Self
Create a new DropNewest policy
Trait Implementations§
Source§impl Clone for QueueOverflowPolicy
impl Clone for QueueOverflowPolicy
Source§fn clone(&self) -> QueueOverflowPolicy
fn clone(&self) -> QueueOverflowPolicy
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 QueueOverflowPolicy
impl Debug for QueueOverflowPolicy
Source§impl Default for QueueOverflowPolicy
impl Default for QueueOverflowPolicy
Source§fn default() -> QueueOverflowPolicy
fn default() -> QueueOverflowPolicy
Returns the “default value” for a type. Read more
Source§impl PartialEq for QueueOverflowPolicy
impl PartialEq for QueueOverflowPolicy
impl Copy for QueueOverflowPolicy
impl Eq for QueueOverflowPolicy
impl StructuralPartialEq for QueueOverflowPolicy
Auto Trait Implementations§
impl Freeze for QueueOverflowPolicy
impl RefUnwindSafe for QueueOverflowPolicy
impl Send for QueueOverflowPolicy
impl Sync for QueueOverflowPolicy
impl Unpin for QueueOverflowPolicy
impl UnsafeUnpin for QueueOverflowPolicy
impl UnwindSafe for QueueOverflowPolicy
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<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.