Struct message_filter::MessageFilter
[−]
[src]
pub struct MessageFilter<Message> where Message: Ord + Clone {
// some fields omitted
}
Implementation of message filter.
Methods
impl<Message> MessageFilter<Message> where Message: Ord + Clone
[src]
fn with_capacity(capacity: usize) -> MessageFilter<Message>
Constructor for capacity based MessageFilter
.
fn with_expiry_duration(time_to_live: Duration) -> MessageFilter<Message>
Constructor for time based MessageFilter
.
fn with_expiry_duration_and_capacity(time_to_live: Duration, capacity: usize) -> MessageFilter<Message>
Constructor for dual-feature capacity and time based MessageFilter
.
fn insert(&mut self, message: Message) -> Option<Message>
Removes any expired messages, then adds message
, then removes enough older messages until
the message count is at or below capacity
. If message
already exists in the filter and
is not already expired, its original expiry time and place in the FIFO queue remains
unchanged by this call.
fn contains(&mut self, message: &Message) -> bool
Removes any expired messages, then returns whether message
exists in the filter or not.
fn len(&self) -> usize
Returns the size of the filter, i.e. the number of added messages.