Skip to content

Add minimal example: hello-mailbox-async #99

@lxsaah

Description

@lxsaah

Difficulty: easy · Estimate: 2–3 hours

The recently-merged hello-mailbox example demonstrates Mailbox buffer semantics using the synchronous API (AimDbBuilderSyncExt, producer.set(), consumer.try_get()). AimDB also has an async builder API (.source() / .tap()) — this is the API showcased in the README quick-start. Add an async sibling so users can compare both styles for the same buffer behavior.

Where to look

What to do

  • Create examples/hello-mailbox-async/ mirroring the sync example's structure (Cargo.toml, src/main.rs, README.md).
  • Implement the same "fire three rapid LED commands, observe only the latest" demo using the async builder:
    builder.configure::<Led>("actuator.led", |reg| {
        reg.buffer(BufferCfg::Mailbox)
            .source(|ctx, producer| async move { /* fire commands */ })
            .tap(|ctx, consumer| async move { /* observe latest */ })
            .finish();
    });
    builder.build()?.run().await?;
  • Add to root Cargo.toml workspace members.
  • Add to the Makefile's fmt and fmt-check package lists and the examples build target (see how hello-mailbox was wired in).
  • README in the example explains how the async API differs from the sync sibling in 1–2 sentences.

Done when

  • cargo run -p hello-mailbox-async works and demonstrates Mailbox latest-wins semantics
  • make check and make all are green with the new crate wired in
  • Linked from the main README's buffer table next to the sync version

We'd love help with this — comment if you'd like to take it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions