Struct SubscriptionState
pub struct SubscriptionState {
pub latest_stream_height: Option<String>,
pub current_filters: MessageFilters,
}Expand description
Serializable subscription state that can be persisted and restored.
This state contains all the information needed to restore a MessagesManager to its previous subscription state after a connection restart.
Fields§
§latest_stream_height: Option<String>The latest stream height we’ve received Used to resume from the correct position after reconnection
current_filters: MessageFiltersCombined subscription filters accumulated over time This represents the union of all active subscriptions
Implementations§
§impl SubscriptionState
impl SubscriptionState
pub fn new() -> SubscriptionState
pub fn new() -> SubscriptionState
Create a new empty subscription state
pub fn with_filters(filters: MessageFilters) -> SubscriptionState
pub fn with_filters(filters: MessageFilters) -> SubscriptionState
Create subscription state with initial filters
pub fn add_filters(&mut self, new_filters: &[Filter])
pub fn add_filters(&mut self, new_filters: &[Filter])
Add filters to the combined state
pub fn remove_filters(&mut self, filters_to_remove: &[Filter])
pub fn remove_filters(&mut self, filters_to_remove: &[Filter])
Remove filters from the combined state
pub fn set_stream_height(&mut self, height: String)
pub fn set_stream_height(&mut self, height: String)
Update the latest stream height
pub fn has_active_filters(&self) -> bool
pub fn has_active_filters(&self) -> bool
Check if we have any active filters
Trait Implementations§
§impl Clone for SubscriptionState
impl Clone for SubscriptionState
§fn clone(&self) -> SubscriptionState
fn clone(&self) -> SubscriptionState
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 more§impl Debug for SubscriptionState
impl Debug for SubscriptionState
§impl Default for SubscriptionState
impl Default for SubscriptionState
§fn default() -> SubscriptionState
fn default() -> SubscriptionState
Returns the “default value” for a type. Read more
§impl<'de> Deserialize<'de> for SubscriptionState
impl<'de> Deserialize<'de> for SubscriptionState
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SubscriptionState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SubscriptionState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl PartialEq for SubscriptionState
impl PartialEq for SubscriptionState
§impl Serialize for SubscriptionState
impl Serialize for SubscriptionState
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for SubscriptionState
Auto Trait Implementations§
impl Freeze for SubscriptionState
impl RefUnwindSafe for SubscriptionState
impl Send for SubscriptionState
impl Sync for SubscriptionState
impl Unpin for SubscriptionState
impl UnwindSafe for SubscriptionState
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