pub struct SubscriptionBuilder { /* private fields */ }Expand description
A builder for a subscription.
Implementations§
Source§impl SubscriptionBuilder
impl SubscriptionBuilder
Sourcepub fn new<H>(topic: Topic<H>) -> SubscriptionBuilderwhere
H: Hasher,
pub fn new<H>(topic: Topic<H>) -> SubscriptionBuilderwhere
H: Hasher,
Create a new subscription builder.
Sourcepub fn message_id_fn<F>(&mut self, id_fn: F) -> &mut SubscriptionBuilder
pub fn message_id_fn<F>(&mut self, id_fn: F) -> &mut SubscriptionBuilder
A user-defined function allowing the user to specify the message id of a pub-sub message.
The default value is to concatenate the source peer id with a sequence number. Setting this
parameter allows the user to address packets arbitrarily. One example is content based
addressing, where this function may be set to hash(message). This would prevent messages
of the same content from being duplicated.
The function takes a FrameMessage as input and outputs a String to be interpreted as the
message id.
pub fn build(self) -> Subscription
Auto Trait Implementations§
impl Freeze for SubscriptionBuilder
impl !RefUnwindSafe for SubscriptionBuilder
impl !Send for SubscriptionBuilder
impl !Sync for SubscriptionBuilder
impl Unpin for SubscriptionBuilder
impl !UnwindSafe for SubscriptionBuilder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 more