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::{Connection, QueueOptions, in_memory::InMemoryConnection};
use paladin::serializer::Serializer;
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
let connection = InMemoryConnection::new(Serializer::default());
// Declare a queue
let handle = connection.declare_queue("my_queue", QueueOptions::default()).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 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 Connection for InMemoryConnection
impl Connection for InMemoryConnection
type QueueHandle = InMemoryQueueHandle
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the connection.
Source§fn declare_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
options: QueueOptions,
) -> 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,
options: QueueOptions,
) -> Pin<Box<dyn Future<Output = Result<Self::QueueHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Declare a queue. Read more
Auto Trait Implementations§
impl Freeze for InMemoryConnection
impl !RefUnwindSafe for InMemoryConnection
impl Send for InMemoryConnection
impl Sync for InMemoryConnection
impl Unpin for InMemoryConnection
impl !UnwindSafe for InMemoryConnection
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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