pub struct StdbSubscriptions<K, M>where
K: Eq + Hash + Clone + Send + Sync + 'static,
M: SpacetimeModule,
M::SubscriptionHandle: StdbSubscriptionHandle + Send + Sync + 'static,{ /* private fields */ }Expand description
SpacetimeDB subscription Resource.
Keeps subscription intent separate from active handles so queued queries can be reapplied after reconnects.
Implementations§
Source§impl<K, M> StdbSubscriptions<K, M>
impl<K, M> StdbSubscriptions<K, M>
Sourcepub fn subscribe_query<T, Q>(
&mut self,
key: K,
query: impl Fn(M::QueryBuilder) -> Q,
)where
Q: Query<T>,
pub fn subscribe_query<T, Q>(
&mut self,
key: K,
query: impl Fn(M::QueryBuilder) -> Q,
)where
Q: Query<T>,
Stores a typed query for key and queues it to be applied.
Sourcepub fn subscribe_sql(&mut self, key: K, sql: impl Into<String>)
pub fn subscribe_sql(&mut self, key: K, sql: impl Into<String>)
Stores a SQL query for key and queues it to be applied.
Sourcepub fn unsubscribe(&mut self, key: &K) -> StdbResult<()>
pub fn unsubscribe(&mut self, key: &K) -> StdbResult<()>
Unsubscribes key and removes its stored query.
Sourcepub fn unsubscribe_all(&mut self) -> StdbResult<()>
pub fn unsubscribe_all(&mut self) -> StdbResult<()>
Unsubscribes all active handles and clears all stored queries.
Returns the first unsubscribe error, if any.
Trait Implementations§
impl<K, M> Resource for StdbSubscriptions<K, M>
Auto Trait Implementations§
impl<K, M> Freeze for StdbSubscriptions<K, M>where
<M as SpacetimeModule>::SubscriptionHandle: Sized,
impl<K, M> RefUnwindSafe for StdbSubscriptions<K, M>
impl<K, M> Send for StdbSubscriptions<K, M>where
<M as SpacetimeModule>::SubscriptionHandle: Sized,
impl<K, M> Sync for StdbSubscriptions<K, M>where
<M as SpacetimeModule>::SubscriptionHandle: Sized,
impl<K, M> Unpin for StdbSubscriptions<K, M>
impl<K, M> UnsafeUnpin for StdbSubscriptions<K, M>where
<M as SpacetimeModule>::SubscriptionHandle: Sized,
impl<K, M> UnwindSafe for StdbSubscriptions<K, M>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.