feat(052): runtime-neutral serial connector - #251
Open
lxsaah wants to merge 3 commits into
Open
Conversation
lxsaah
force-pushed
the
feat/platform-agnostic-serial-connector
branch
from
September 6, 2026 09:17
17f2f55 to
fa71346
Compare
…encies - Updated the Makefile to replace the `_test-tokio` feature with `tokio-runtime` for testing and clippy commands. - Renamed `SerialDialer` to `SerialPortDialer` in the endpoint resolution to reflect the new naming convention. - Removed the `_test-tokio` feature from the `Cargo.toml` of `aimdb-serial-connector` and updated dependencies accordingly. - Refactored the `serial_demo` example to use the new `tokio-runtime` feature instead of `_test-tokio`. - Deleted the `embassy_transport.rs` file and moved relevant functionality to the `connector` module. - Updated tests to use the new `OneShotDialer` and `OneShotListener` from the `connector` module. - Modified the `main.rs` files in various examples to utilize `EmbassyUart` for serial connections.
The Unreleased entry still promised `_test-tokio` "remains as an alias", which B5 made false by removing it. Replaces that with the breaking surface: `SerialServer::new` takes an adapter byte stream, the two transport modules and the `Tokio*`/`Embassy*` aliases are gone, and `SerialDialer` is now `SerialPortDialer`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lxsaah
force-pushed
the
feat/platform-agnostic-serial-connector
branch
from
September 6, 2026 09:29
fa71346 to
2a84a12
Compare
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.
Wave B of design 052, second connector. The adapter owns the byte source; this crate contributes only COBS framing.
Same add → migrate → delete shape as the TCP connector (#250), so the deletion commit is purely subtractive and every commit is green on its own.
Result
One path for both runtimes.
tokio_transport.rs(312) andembassy_transport.rs(237) are gone, along with the wholeall(tokio-runtime, embassy-runtime)alias set — those names existed only to disambiguate two implementations of the same thing._test-tokiois removed too. It existed solely to add the adapter for tests;tokio-runtimecarries it now, so the alias had nothing left to gate.Breaking
SerialServer::newtakes an adapter byte stream —EmbassyUart::new(rx, tx)orTokioByteStream(port)— instead of(path, baud)or split UART halves. The application opens the device, which is where device ownership belongs.SerialDialer→SerialPortDialer.SerialListener,TokioSerialConnectionand theTokio*/Embassy*aliases are gone.SerialClient::new(stream)serves a moved-in stream once;SerialClient::over_port(path, baud)reopens and redials on a host.Updated in-tree: three embassy demos,
aimdb-client's serial arm, andserial_demo.Worth a look in review
A UART is point-to-point, so there is no accept loop.
OneShotDialerhands the connection out once then errors — nothing to redial.OneShotListenerhands it out once then parks forever, becauseserveloops onacceptand an error would spin it. Both are neutral (built on core'sOneShot, nounsafe), replacing the Embassy adapter'sSendFutureWrapper-carrying versions.FramingDialeris deliberately unused here. It exists to attach ahost/portto aStreamDialer; serial has neither — the device path is the dialer's own state and baud is configuration.FramedConnectionis used directly.tokio-serialstays in the connector, not the adapter: opening a tty is not a runtime concern (design §3.3).SerialServer::buildtakes its stream on first poll, not at call time — abuild()future dropped before being polled must leave the stream in place. Covered bythe_server_guards_its_moved_in_stream.Notes
Branched from
main, not from #250. Both touchaimdb-client/src/endpoint.rs; whichever merges second needs a rebase there.