pub trait Handler {
// Required methods
fn read(
&self,
ctx: impl ReadContext,
reply: impl ReadReply,
) -> Result<(), Error>;
fn bump_dataver(&self, ctx: impl MatchContext);
// Provided methods
fn write(&self, _ctx: impl WriteContext) -> Result<(), Error> { ... }
fn invoke(
&self,
_ctx: impl InvokeContext,
_reply: impl InvokeReply,
) -> Result<(), Error> { ... }
fn lifecycle(
&self,
_ctx: impl HandlerContext,
_op: LifecycleOp,
) -> Result<(), Error> { ... }
fn run(
&self,
_ctx: impl HandlerContext,
) -> impl Future<Output = Result<(), Error>> { ... }
}Expand description
A version of the AsyncHandler trait that never awaits any operation.
Prefer this trait when implementing handlers that are known to be non-blocking and additionally,
mark those with NonBlockingHandler.
Required Methods§
Sourcefn read(
&self,
ctx: impl ReadContext,
reply: impl ReadReply,
) -> Result<(), Error>
fn read( &self, ctx: impl ReadContext, reply: impl ReadReply, ) -> Result<(), Error>
Read from the requested attribute and encode the result using the provided reply type.
Sourcefn bump_dataver(&self, ctx: impl MatchContext)
fn bump_dataver(&self, ctx: impl MatchContext)
Bump the per-cluster Dataver for the cluster handler matching
the supplied context endpoint_id / cluster_id.
Provided Methods§
Sourcefn write(&self, _ctx: impl WriteContext) -> Result<(), Error>
fn write(&self, _ctx: impl WriteContext) -> Result<(), Error>
Write into the requested attribute using the provided data.
Sourcefn invoke(
&self,
_ctx: impl InvokeContext,
_reply: impl InvokeReply,
) -> Result<(), Error>
fn invoke( &self, _ctx: impl InvokeContext, _reply: impl InvokeReply, ) -> Result<(), Error>
Invoke the requested command with the provided data and encode the result using the provided reply type.
Sourcefn lifecycle(
&self,
_ctx: impl HandlerContext,
_op: LifecycleOp,
) -> Result<(), Error>
fn lifecycle( &self, _ctx: impl HandlerContext, _op: LifecycleOp, ) -> Result<(), Error>
Process a lifecycle operation (LifecycleOp).
Unlike read/write/invoke - which are routed to the single handler matching the operation path - this method is invoked on every handler in the handler chain.
The default implementation does nothing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".