Repository navigation
docs: input and contract conventions, connect + publish / subscribe (#391, stage 4) - #403
Merged
Merged
Conversation
…391) Usage guide: - "Inputs and contracts: conventions": inputs yield events and records are built with From<Event>; device channels are owned, non-Clone values; where the From impls live (orphan rule); what is checked at compile time and what at build() - the MQTT example registers with connect and links a Linkable contract with subscribe / publish; the KNX example is marked as the raw-builder escape hatch - the Embassy Quick Start wires its button as an Input built From<ButtonEvent> - a duplicated "Using Connectors" heading removed Rustdoc: Input states both conventions and has a compile_fail,E0382 doctest for a channel used twice; AimDbBuilder::connect shows publish next to OutboundLink::on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Tokio Quick Start and the KNX example imported aimdb_core::prelude, which does not exist, and used APIs that have changed: an awaited produce(), subscribe().unwrap(), a deserializer without the context argument returning a Box, and db.run() on build()'s result. Both now use explicit imports, configure on a mut builder and builder.run(), and the Quick Start drops the rand dependency it never declared. The crate versions in the Cargo.toml snippets and the version-pinning section move to the current ones (aimdb-core 2.0, adapters and MQTT 0.7). The Tokio Quick Start, KNX and MQTT examples were each compiled as a temporary example target in the workspace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stage 4 of #391, into the #392 feature branch.
docs/aimdb-usage-guide.mdFrom<Event>. A device that sends its own payload is an input over a connection.Clonevalues handed out by a board (NucleoInputs { b1 }), so using one twice isuse of moved value.From<Event>impls live: the orphan rule, the driver/contract crate convention, and a newtype or.transform()when neither crate can.build()errors. "One input per record" stays abuild()error, and fan-in is allowed.builder.connect(..)with aLinkablecontract viasubscribe/publish, including the neededCargo.tomllines. It points to the raw builders for non-contract types.link_from(..).with_deserializer(..).finish()builder, now labelled as the escape hatch.PushButtoninput, withButtonPress: From<ButtonEvent>and.input(button), instead ofsource_with_context.aimdb_core::preludedoesn't exist, and the Tokio Quick Start and the KNX example also used APIs that have changed: an awaitedproduce(),subscribe().unwrap(), a deserializer without the context argument returning aBox, anddb.run()onbuild()'s result. Both now use explicit imports,configureon amutbuilder andbuilder.run(). The Quick Start drops theranddependency it never declared.Cargo.tomlsnippets and the version-pinning section move toaimdb-core2.0, the adapters and MQTT 0.7.Rustdoc
Inputstates both conventions and adds acompile_fail,E0382doctest for a device channel wired into two records.AimDbBuilder::connectshowspublishfor a contract next toOutboundLink::onwith a serializer.The Tokio Quick Start has no connector, so it doesn't use
connect.Checks
CI doesn't run on PRs into the feature branch, so I ran these locally:
aimdb-coredoctests (the new E0382 case among them)cargo docwith-D warningsfor core and data-contractscargo clippyon core (std,tracing,observability)tokio-mqtt-connector-demo/tokio-knx-connector-demo), without warnings, and removed againembassy_rp, and that isn't in the workspaceNext
Related Issue
🤖 Generated with Claude Code