pub struct Subscription {
pub handler: ShareableMessageHandler,
pub handler_id: Ustr,
pub topic: Ustr,
pub priority: u8,
}
Expand description
Represents a subscription to a particular topic.
This is an internal class intended to be used by the message bus to organize topics and their subscribers.
§Warnings
Assigning priority handling is an advanced feature which shouldn’t normally be needed by most users. Only assign a higher priority to the subscription if you are certain of what you’re doing. If an inappropriate priority is assigned then the handler may receive messages before core system components have been able to process necessary calculations and produce potential side effects for logically sound behavior.
Fields§
§handler: ShareableMessageHandler
The shareable message handler for the subscription.
handler_id: Ustr
Store a copy of the handler ID for faster equality checks.
topic: Ustr
The topic for the subscription.
priority: u8
The priority for the subscription determines the ordering of handlers receiving messages being processed, higher priority handlers will receive messages before lower priority handlers.
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub fn new<T: AsRef<str>>(
topic: T,
handler: ShareableMessageHandler,
priority: Option<u8>,
) -> Self
pub fn new<T: AsRef<str>>( topic: T, handler: ShareableMessageHandler, priority: Option<u8>, ) -> Self
Creates a new Subscription
instance.
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Subscription
impl Debug for Subscription
Source§impl Hash for Subscription
impl Hash for Subscription
Source§impl Ord for Subscription
impl Ord for Subscription
Source§impl PartialEq for Subscription
impl PartialEq for Subscription
Source§impl PartialOrd for Subscription
impl PartialOrd for Subscription
impl Eq for Subscription
Auto Trait Implementations§
impl Freeze for Subscription
impl !RefUnwindSafe for Subscription
impl Send for Subscription
impl !Sync for Subscription
impl Unpin for Subscription
impl !UnwindSafe for Subscription
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more