pub struct MessagePatternDefinition { /* private fields */ }Expand description
Framework-neutral message pattern handler definition.
Implementations§
Source§impl MessagePatternDefinition
impl MessagePatternDefinition
pub fn request<H, Fut, R>(
pattern: impl Into<String>,
handler: H,
) -> Result<Self>where
H: Fn(TransportMessage) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<R>> + Send + 'static,
R: IntoTransportReply + Send + 'static,
Sourcepub fn request_scoped<F, H, Fut, R>(
pattern: impl Into<String>,
factory: F,
) -> Result<Self>
pub fn request_scoped<F, H, Fut, R>( pattern: impl Into<String>, factory: F, ) -> Result<Self>
Build a request-response pattern whose handler is created from the current message dispatch’s dependency-injection scope.
pub fn event<H, Fut>(pattern: impl Into<String>, handler: H) -> Result<Self>
Sourcepub fn event_scoped<F, H, Fut>(
pattern: impl Into<String>,
factory: F,
) -> Result<Self>
pub fn event_scoped<F, H, Fut>( pattern: impl Into<String>, factory: F, ) -> Result<Self>
Build an event pattern whose handler is created from the current message dispatch’s dependency-injection scope.
pub fn request_json<T, H, Fut, R>( pattern: impl Into<String>, handler: H, ) -> Result<Self>
pub fn request_validated_json<T, H, Fut, R>( pattern: impl Into<String>, handler: H, ) -> Result<Self>
pub fn event_json<T, H, Fut>( pattern: impl Into<String>, handler: H, ) -> Result<Self>
pub fn event_validated_json<T, H, Fut>( pattern: impl Into<String>, handler: H, ) -> Result<Self>
pub fn pattern(&self) -> &str
pub fn kind(&self) -> MessagePatternKind
Sourcepub fn is_scoped(&self) -> bool
pub fn is_scoped(&self) -> bool
Return whether this pattern constructs its handler from each dispatch scope.
pub fn module_name(&self) -> Option<&str>
pub fn metadata(&self) -> &BTreeMap<String, Value>
pub fn metadata_value(&self, key: &str) -> Option<&Value>
pub fn with_metadata<V>(self, key: impl Into<String>, value: V) -> Result<Self>where
V: Serialize,
pub fn with_metadata_value(self, key: impl Into<String>, value: Value) -> Self
pub fn with_pipe<P>(self, pipe: P) -> Selfwhere
P: TransportPipe,
pub fn with_guard<G>(self, guard: G) -> Selfwhere
G: TransportGuard,
pub fn with_execution_guard<G>(self, guard: G) -> Selfwhere
G: Guard,
pub fn with_interceptor<I>(self, interceptor: I) -> Selfwhere
I: TransportInterceptor,
pub fn with_execution_interceptor<I>(self, interceptor: I) -> Selfwhere
I: ExecutionInterceptor,
pub fn with_filter<F>(self, filter: F) -> Selfwhere
F: TransportExceptionFilter,
pub fn with_catch_filter<I, F>(self, kinds: I, filter: F) -> Self
pub fn with_validation(self) -> Self
pub fn with_validation_options(self, options: ValidationOptions) -> Self
pub fn without_validation(self) -> Self
pub fn with_payload_validation<T>(self) -> Selfwhere
T: DeserializeOwned + Validate + 'static,
pub fn with_payload_validation_options<T>( self, options: ValidationOptions, ) -> Self
pub async fn dispatch( &self, message: TransportMessage, ) -> Result<Option<TransportReply>>
Trait Implementations§
Source§impl Clone for MessagePatternDefinition
impl Clone for MessagePatternDefinition
Source§fn clone(&self) -> MessagePatternDefinition
fn clone(&self) -> MessagePatternDefinition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for MessagePatternDefinition
impl !UnwindSafe for MessagePatternDefinition
impl Freeze for MessagePatternDefinition
impl Send for MessagePatternDefinition
impl Sync for MessagePatternDefinition
impl Unpin for MessagePatternDefinition
impl UnsafeUnpin for MessagePatternDefinition
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