pub trait ServiceHandler: MaybeSendSync + 'static {
type Workload: Workload;
}Expand description
Associator trait emitted by protoc-gen: maps a user-implemented handler
type to the generated {Service}Workload<Self> wrapper.
Users never implement this trait by hand; the generator’s
{Service}Handler trait expands into a super-trait bound on it so the
framework can recover type Workload without name mangling.
§Design notes
MaybeSendSync + 'staticmirrors the bound on every{Service}Handler, so downstream generic code can composeServiceHandlerbounds into dispatcher-generic functions without re-stating the auto-trait marker.- The associated type pins a concrete
Workloadimpl, not adyn Workload. Static dispatch all the way down — matching the rest of the framework’s zero-cost abstractions.
Required Associated Types§
Sourcetype Workload: Workload
type Workload: Workload
Concrete Workload wrapper for this handler.
protoc-gen’s {Service}Handler trait sets this to the generated
{Service}Workload<Self> wrapper, which carries the dispatcher
(via type Dispatcher = {Service}Dispatcher<Self>) and inherits
every observation-hook default from Workload.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".