[−][src]Trait spartan_lib::core::dispatcher::PositionBasedDelete
Interface for deleting messages from queue, where database position key is the same, as message ID
Required methods
pub fn delete(&mut self, id: <M as Identifiable>::Id) -> Option<M>
[src]
Delete message from queue
Returns owned message if id is present in database
use spartan_lib::core::dispatcher::{SimpleDispatcher, PositionBasedDelete}; use spartan_lib::core::db::TreeDatabase; use spartan_lib::core::message::builder::MessageBuilder; use spartan_lib::core::payload::Identifiable; let mut db = TreeDatabase::default(); let message = MessageBuilder::default().body("Hello, world").compose().unwrap(); db.push(message.clone()); assert_eq!(db.size(), 1); assert_eq!(db.delete(message.id()).unwrap().id(), message.id()); assert_eq!(db.size(), 0);
Implementors
impl<T, M> PositionBasedDelete<M> for T where
T: Database<M, PositionKey = <M as Identifiable>::Id>,
M: Dispatchable,
[src]
T: Database<M, PositionKey = <M as Identifiable>::Id>,
M: Dispatchable,