pub struct MessagesManagerBuilder {
state: SubscriptionState,
buffer_size: Option<usize>,
autosubscribe: bool,
}Expand description
Builder for creating MessagesManager instances with persistent state support.
This builder allows you to configure the MessagesManager with previous state, buffer sizes, and other options before connecting to the message service.
§Example
// Create with previous state
let previous_state = SubscriptionState::new();
let manager = MessagesManagerBuilder::new()
.state(previous_state)
.buffer_size(2000)
.build(connection)
.await?;
// Or create fresh
let manager = MessagesManagerBuilder::new()
.build(connection)
.await?;Fields§
§state: SubscriptionStatePrevious subscription state to restore
buffer_size: Option<usize>Buffer size for the broadcast channel
autosubscribe: boolwhether to automatically issue the subscribe command at start
Implementations§
Source§impl MessagesManagerBuilder
impl MessagesManagerBuilder
Sourcepub fn state(self, state: SubscriptionState) -> Self
pub fn state(self, state: SubscriptionState) -> Self
Set the subscription state to restore from
pub fn with_filters(self, filters: MessageFilters) -> Self
Sourcepub fn buffer_size(self, size: usize) -> Self
pub fn buffer_size(self, size: usize) -> Self
Set the buffer size for the broadcast channel
pub fn autosubscribe(self, autosubscribe: bool) -> Self
Sourcepub async fn build(self, connection: &Connection) -> Result<MessagesManager>
pub async fn build(self, connection: &Connection) -> Result<MessagesManager>
Build the MessagesManager by connecting to the service
This will:
- Connect to the messages service
- Restore previous subscription state if any
- Start the message broadcasting
- Return a fully configured MessagesManager
Trait Implementations§
Source§impl Debug for MessagesManagerBuilder
impl Debug for MessagesManagerBuilder
Auto Trait Implementations§
impl Freeze for MessagesManagerBuilder
impl RefUnwindSafe for MessagesManagerBuilder
impl Send for MessagesManagerBuilder
impl Sync for MessagesManagerBuilder
impl Unpin for MessagesManagerBuilder
impl UnwindSafe for MessagesManagerBuilder
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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