Module toad::step

source ·
Expand description

The Step trait

The Step trait defines a powerful but simple API that allows the CoAP runtime to be a composition of “steps,” stored as a type-level linked list.

e.g.

Gather Ingredients
  -> Mix Wet Ingredients
  -> Mix Dry Ingredients
  -> Mix Everything together
  -> Pour into cake tin
  -> Bake

as Steps:

Bake<PourIntoCakeTin<MixEverything<MixDry<MixWet<GatherIngredients<Empty>>>>>>

Capabilities

Determinism

Steps provided by this crate will never perform any observable IO, aside from managing their own internal state and appending to the list of effects provided in the poll_req/poll_resp fns.

Logging

Steps provided by this crate will never log to any streams directly, and will provide them via platform::Effect::Log.

It is strongly recommended that log::Level::Warn and log::Level::Error messages are not ignored.

Re-exports

Modules

Macros

  • Specialized ? operator for use in step bodies, allowing early-exit for Result, Option<Result> and Option<nb::Result>.
  • Macro to execute inner steps, converting the Option<nb::Result<T, E>> to Option<T> by returning the inner step’s Errors & WouldBlock
  • Issue an Effect::Log

Traits

  • An error that can be returned by a Step.
  • A step in the message-handling CoAP runtime.

Type Definitions