pub struct ChannelMap<T> { /* private fields */ }Expand description
Defines independently queued Channel instances under one name.
Supply an instance string for every publish, read, condition, and completion guard. Add the map
definition once to crate::PersistenceSchema.
Implementations§
Source§impl<T> ChannelMap<T>
impl<T> ChannelMap<T>
Sourcepub fn publish(
&self,
context: &mut Context,
instance: &str,
value: T,
) -> HandlerResult<()>where
T: Value,
pub fn publish(
&self,
context: &mut Context,
instance: &str,
value: T,
) -> HandlerResult<()>where
T: Value,
Stages one message for instance from the current invocation.
§Errors
Returns a crate::HandlerError when value cannot be encoded.
Sourcepub fn size(&self, context: &Context, instance: &str) -> HandlerResult<usize>
pub fn size(&self, context: &Context, instance: &str) -> HandlerResult<usize>
Returns the invocation snapshot’s message count for instance.
Sourcepub fn map_size(&self, context: &Context) -> HandlerResult<usize>
pub fn map_size(&self, context: &Context) -> HandlerResult<usize>
Returns the number of non-empty instances visible to the current RPC.
Sourcepub fn all_instance_keys(&self, context: &Context) -> HandlerResult<Vec<String>>
pub fn all_instance_keys(&self, context: &Context) -> HandlerResult<Vec<String>>
Returns sorted decoded non-empty keys, including buffered publishes.
Sourcepub fn condition_results(
&self,
context: &Context,
instance: &str,
) -> HandlerResult<Vec<T>>where
T: Value,
pub fn condition_results(
&self,
context: &Context,
instance: &str,
) -> HandlerResult<Vec<T>>where
T: Value,
Decodes messages consumed by instance’s satisfied condition.
§Errors
Returns a crate::HandlerError when a message cannot be decoded.
Sourcepub fn for_one(&self, instance: &str) -> Condition
pub fn for_one(&self, instance: &str) -> Condition
Creates an instance condition that consumes exactly one message.
Sourcepub fn for_n(&self, instance: &str, count: usize) -> Condition
pub fn for_n(&self, instance: &str, count: usize) -> Condition
Creates an instance condition that consumes exactly count messages.
Sourcepub fn at_least(&self, instance: &str, count: usize) -> Condition
pub fn at_least(&self, instance: &str, count: usize) -> Condition
Creates an instance condition with an inclusive lower queue-size bound.
Sourcepub fn at_most(&self, instance: &str, count: usize) -> Condition
pub fn at_most(&self, instance: &str, count: usize) -> Condition
Creates an instance condition with an inclusive upper queue-size bound.
Sourcepub fn range(
&self,
instance: &str,
at_least: Option<usize>,
at_most: Option<usize>,
) -> Condition
pub fn range( &self, instance: &str, at_least: Option<usize>, at_most: Option<usize>, ) -> Condition
Creates an instance condition with optional inclusive lower and upper bounds.
Sourcepub fn when_empty(&self, instance: &str) -> ChannelGuard
pub fn when_empty(&self, instance: &str) -> ChannelGuard
Creates a conditional-completion guard requiring instance to be empty.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ChannelMap<T>
impl<T> RefUnwindSafe for ChannelMap<T>
impl<T> Send for ChannelMap<T>
impl<T> Sync for ChannelMap<T>
impl<T> Unpin for ChannelMap<T>
impl<T> UnsafeUnpin for ChannelMap<T>
impl<T> UnwindSafe for ChannelMap<T>
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,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request