Struct message_filter::MessageFilter [] [src]

pub struct MessageFilter<Message> where Message: PartialOrd + Ord + Clone + Hash {
    // some fields omitted
}

Implementation of message filter.

Methods

impl<Message> MessageFilter<Message> where Message: PartialOrd + Ord + Clone + Hash
[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 add(&mut self, message: Message)

Removes any expired messages, then adds message, then removes enough older messages until the message count is at or below capacity.

fn check(&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 cache, i.e. the number of cached messages.