Struct paladin::queue::in_memory::InMemoryConnection
source · pub struct InMemoryConnection { /* private fields */ }Expand description
An in-memory implementation of Connection.
This implementation maintains a stable set of queues, and is cloneable. Each clone of the connection will maintain references to the same underlying queues.
use paladin::queue::{Queue, Connection, in_memory::InMemoryQueue};
use paladin::serializer::Serializer;
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
let queue = InMemoryQueue::new(Serializer::Cbor);
let connection = queue.get_connection().await?;
// Declare a queue
let handle = connection.declare_queue("my_queue").await?;
// ...
// Delete a queue
connection.delete_queue("my_queue").await?;
Ok(())
}Implementations§
source§impl InMemoryConnection
impl InMemoryConnection
pub fn new(serializer: Serializer) -> Self
Trait Implementations§
source§impl Clone for InMemoryConnection
impl Clone for InMemoryConnection
source§fn clone(&self) -> InMemoryConnection
fn clone(&self) -> InMemoryConnection
Returns a copy 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 Connection for InMemoryConnection
impl Connection for InMemoryConnection
type QueueHandle = InMemoryQueueHandle
source§fn declare_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self::QueueHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn declare_queue<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Self::QueueHandle>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Queue declaration should be idempotent, in that it should instantiate a
queue if it does not exist, and otherwise return the existing queue.
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryConnection
impl Send for InMemoryConnection
impl Sync for InMemoryConnection
impl Unpin for InMemoryConnection
impl !UnwindSafe for InMemoryConnection
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