pub struct MemoryPublisher { /* private fields */ }Expand description
A sink that sends messages to an in-memory channel.
Implementations§
Source§impl MemoryPublisher
impl MemoryPublisher
pub fn new(config: &MemoryConfig) -> Result<Self>
pub async fn new_async(config: &MemoryConfig) -> Result<Self>
Sourcepub fn new_local(topic: &str, capacity: usize) -> Self
pub fn new_local(topic: &str, capacity: usize) -> Self
Creates a new local memory publisher.
This method creates a new in-memory publisher with the specified topic and capacity. The publisher will send messages to the in-memory channel for the specified topic.
Sourcepub fn channel(&self) -> MemoryChannel
pub fn channel(&self) -> MemoryChannel
Note: This helper is primarily for tests expecting a Queue.
If used on a broadcast publisher, it will create a separate Queue channel.
Trait Implementations§
Source§impl Clone for MemoryPublisher
impl Clone for MemoryPublisher
Source§fn clone(&self) -> MemoryPublisher
fn clone(&self) -> MemoryPublisher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryPublisher
impl Debug for MemoryPublisher
Source§impl MessagePublisher for MemoryPublisher
impl MessagePublisher for MemoryPublisher
fn send<'life0, 'async_trait>(
&'life0 self,
message: CanonicalMessage,
) -> Pin<Box<dyn Future<Output = Result<Sent, PublisherError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn send_batch<'life0, 'async_trait>(
&'life0 self,
messages: Vec<CanonicalMessage>,
) -> Pin<Box<dyn Future<Output = Result<SentBatch, PublisherError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_batch<'life0, 'async_trait>(
&'life0 self,
messages: Vec<CanonicalMessage>,
) -> Pin<Box<dyn Future<Output = Result<SentBatch, PublisherError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends a batch of messages. Read more
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = EndpointStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn as_any(&self) -> &dyn Any
Source§fn on_connect_hook(&self) -> Option<BoxFuture<'_, Result<()>>>
fn on_connect_hook(&self) -> Option<BoxFuture<'_, Result<()>>>
Returns an optional lifecycle hook that runs once after the publisher connection is created. Read more
Source§fn on_disconnect_hook(&self) -> Option<BoxFuture<'_, Result<()>>>
fn on_disconnect_hook(&self) -> Option<BoxFuture<'_, Result<()>>>
Returns an optional lifecycle hook that runs before the publisher is dropped. Read more
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryPublisher
impl !UnwindSafe for MemoryPublisher
impl Freeze for MemoryPublisher
impl Send for MemoryPublisher
impl Sync for MemoryPublisher
impl Unpin for MemoryPublisher
impl UnsafeUnpin for MemoryPublisher
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