Skip to main content

Module runtime

Module runtime 

Source
Expand description

Application object, middleware and dispatch.

Modules§

cli
The process entry point generated by #[ruststream::app].
forms
Form tokens for IncludeDef: which mounting machinery a definition uses.
layers
Bundled, opinionated middleware layers ready to drop into a handler stack.

Structs§

After
A builder for an outcome-gated post-settle hook, returned by Context::after.
AppInfo
Service-level metadata, surfaced to the AsyncAPI generator as the spec Info object.
BatchInjectHandler
The batch handler built from a BatchInjectDef once its injections resolved: decode the batch, run the body with them, settle every delivery.
BatchPublishTransformStack
Composes two BatchPublishTransforms: inner runs first, then outer. Built by TypedPublisher::batch_transform; you rarely name it directly.
BatchPublishingHandler
The BatchHandler built from a BatchPublishingDef: decode the batch, run the handler, publish the replies through the ReplyPublisher, then ack the batch.
BatchTransformIdentity
The no-op BatchPublishTransform: the default for a TypedPublisher with no batch transforms.
Bindable
A broker wrapped for token minting before registration.
Bound
A publisher source bound to a concrete broker instance, minted by Bindable::bind.
BrokerScope
A handler-registration scope bound to one broker.
Context
Per-delivery context, threaded through middleware and into the handler.
Ctx
Extractor that injects one broker context field into a handler, by its key.
Decoded
The typed input kind: the payload decodes into an owned T, the handler borrows &T.
DynStack
A Layer that runs a frozen list of DynMiddleware before the handler it wraps.
DynStackHandler
Handler produced by DynStack::layer. Runs the frozen middleware chain, then the wrapped handler.
FailurePolicies
The pair of failure policies a subscriber carries: one for a handler panic, one for a decode failure. Threaded from the def to the dispatch loop alongside the Workers policy.
ForBatch
Adapts a per-message PublishTransform into a BatchPublishTransform, applying it to each reply of a batch. Built by for_batch.
HandlerMetadata
Descriptive metadata for a registered subscriber handler.
HealthProbe
A cheap, cloneable handle reporting the service’s HealthState.
Identity
The identity Layer: returns the handler unchanged. The default global stack on RustStream.
IncludeWith
A registration builder over one attachment, generic over its mount token.
IncludeWithOut
A registration builder with two attachments, for a publishing handler that also takes an Out parameter.
InjectHandler
The Handler built from an InjectDef once its injections resolved: decode, then run the body with them.
Next
A cursor over the remaining middleware in a DynStack, ending in the wrapped handler.
Out
The marker a handler signature uses to receive an injected publisher: Out(out): Out<P> binds out to &P inside the body.
Outgoing
A mutable outgoing message flowing through the publish pipeline.
PublishContext
A read-only view of the originating delivery, handed to a PublishTransform.
PublishDynNext
A cursor over the rest of a PublishDynStack, ending in the surrounding static pipeline.
PublishDynStack
A single static PublishLayer wrapping a runtime-built, frozen list of PublishDynLayer.
PublishIdentity
The terminal PublishPipeline: no middleware, just the broker send. The default for an app with no publish_layer.
PublishNext
A cursor over the rest of the publish pipeline, ending in the broker send. Handed to a PublishLayer; call run to continue.
PublishStack
Prepends a PublishLayer Head to a PublishPipeline Tail. Built by RustStream::publish_layer; you rarely name it directly.
PublishTransformIdentity
The no-op PublishTransform: the default for a TypedPublisher with no static transforms.
PublishTransformStack
Composes two PublishTransforms: inner runs first, then outer. Built by TypedPublisher::transform; you rarely name it directly.
PublishingHandler
The Handler built from a PublishingDef: decode, run, deliver the reply, ack.
RawBytes
The raw input kind: nothing decodes, the handler borrows the payload bytes as delivered.
Router
A statically-typed, lazily-bound group of handler registrations, not attached to any broker.
RouterSink
The runtime collector a router mounts into: type-erased starters plus handler metadata.
RunningApp
A started service, handed out by RustStream::start.
RustStream
The top-level application object.
Seek
The marker a handler signature uses to receive its subscription’s seeker: Seek(seeker): Seek<K> binds seeker to &K inside the body.
Settle
The settlement of one dispatched message: the HandlerResult outcome the dispatcher acts on, plus an optional post-settle continuation.
Setup
RustStream phase marker: the builder is still being configured - the state type, the middleware stack, and the publish pipeline may change, and no broker is registered yet.
Stack
Composes two layers into one: inner is applied first (innermost), outer wraps it.
State
Extractor that injects a piece of the shared application state into a handler.
TransactionScope
A live broker transaction, opened by Transactional::begin.
Transactional
A TypedPublisher whose batch replies are published inside one broker transaction.
Typed
Handler produced by typed (or Typed::over for a non-decoding input kind). Override the decode-failure policy with Typed::on_decode_failure.
TypedBatch
The decode adapter for batches, the Typed counterpart, generic over the element’s input kind.
TypedPublisher
A byte Publisher paired with a Codec and a static PublishTransform stack, ready to send typed values.
TypedTransaction
An owned broker transaction carrying the publisher’s codec, opened by TypedPublisher::transaction.
Wired
RustStream phase marker: at least one broker (with its handlers) is registered, so the state type, the middleware stack, and the publish pipeline are fixed.
Workers
Concurrency policy for one subscriber’s dispatch loop, declared with the workers(..) macro argument (or Workers::sequential by default).

Enums§

BatchResult
The settlement of one dispatched batch.
FailurePolicy
What a subscriber does when it cannot process a message.
HandlerResult
What the router should do with the message after the handler returns.
HealthState
The lifecycle state reported by a HealthProbe.
RustStreamError
Errors surfaced while running a RustStream service.
TransactionPublishError
Error returned by TransactionScope::publish.

Constants§

RETRY_COUNT_HEADER
Header carrying the framework’s deferred-republish retry count.

Traits§

App
The functional surface of a built RustStream service: run it, and read the metadata the AsyncAPI generator and the generated CLI need.
BatchDef
A batch handler definition produced by #[subscriber(batch(..))].
BatchInjectCall
Runs a BatchInjectDef’s handler body over an app state of type S.
BatchInjectDef
A batch definition whose handler takes startup-injected parameters.
BatchPublishTransform
A static publish transform that runs only on a #[subscriber(batch(..), publish(..))] handler’s replies, not on single-message replies.
BatchPublishingCall
Runs a BatchPublishingDef’s handler body over an app state of type S.
BatchPublishingDef
A batch subscriber definition that produces replies to publish.
BlanketLayer
A Layer that wraps a handler on any message type, not one fixed H.
BrokerRegistration
What the with_broker family accepts.
DecodeWith
An InputKind that knows how to decode itself with the codec C.
DynMiddleware
A middleware in the around / next style, operating on a borrowed input I and its Context.
ErasedPublisher
A publisher with its concrete type and error erased.
FromContext
A value resolved from the per-delivery Context and shared state, ready to be passed to a handler as a parameter.
FromRef
Produces a value from a reference to the shared application state S.
FromStartup
A handler parameter resolved once per subscription at startup.
Handler
A handler invoked on each input it is given.
HandlerExt
Convenience extension trait for fluent layer stacking on any Handler.
IncludeDef
Ties a definition type to its form token.
InjectCall
Runs an InjectDef’s handler body over an app state of type S (the same state-generic shape as Handler; see PublishingCall for the rationale).
InjectDef
A subscriber definition whose handler takes startup-injected parameters.
InputKind
One kind of handler input: the owned decode product and the borrowed view lent to the handler.
IntoBatchResult
Conversion into a BatchResult, so #[subscriber(batch(..))] handlers can return a plain value.
IntoSettle
Conversion into a Settle, so #[subscriber] handlers can return a plain value instead of always constructing one.
Layer
A function from one handler to another. Apply with HandlerExt::with.
PublishDynLayer
An object-safe publish middleware, for a PublishDynStack.
PublishLayer
Middleware that transforms (or observes) an Outgoing message before it is published.
PublishPipeline
A static, app-wide publish pipeline: an around-style chain of PublishLayer ending in the broker send.
PublishTransform
A static, compile-time publish transform: mutates an Outgoing before it is sent, with read access to the originating delivery through PublishContext.
PublishingCall
Runs a PublishingDef’s handler body over an app state of type S.
PublishingDef
A subscriber definition that produces a reply to publish.
ReplyPublisher
The reply wiring accepted by the include_batch_publishing mounts.
ReplySink
The reply-wiring axis: how a handler’s reply value leaves the service.
ReplyWiring
The decode-codec view of a reply wiring, readable before pairing.
RouterDef
A mountable group of handler registrations.
RouterHandlers
Metadata collection over a router’s registration list, independent of the app state type.
SliceHandler
A handler invoked with one whole decoded batch.
SubscriberDef
A handler definition produced by the #[subscriber] macro (with or without raw).

Functions§

for_batch
Lifts a per-message PublishTransform onto the batch path so the same transform can be added with TypedPublisher::batch_transform without a second implementation.
typed
Build a Handler<M> that decodes the payload with codec into T and forwards &T to inner.

Type Aliases§

IncludeBatchOut
The builder BrokerScope::include_batch returns for a batch handler with an Out parameter.
IncludeBatchPublishing
The builder BrokerScope::include_batch returns for a batch(.., publish("dest")) definition.
IncludeBatchPublishingOut
The builder BrokerScope::include_batch returns for a batch(.., publish("dest")) definition whose handler also takes an Out parameter.
IncludeOut
The builder BrokerScope::include returns for a handler with an Out parameter: the attachment is the parameter’s publish policy, with no default.
IncludePublishing
The builder BrokerScope::include returns for a publish("dest") definition: the attachment is the reply source, defaulting to the broker’s default publish policy under the default codec.
IncludePublishingOut
The builder BrokerScope::include returns for a publish("dest") / publish_raw("dest") definition whose handler also takes an Out parameter.