Implement AtatLen with heapless LenT#254
Merged
MathiasKoch merged 2 commits intoMar 4, 2026
Merged
Conversation
I think that it may be nicer to have dependency versions declared in the workspace Cargo.toml. That way, you don't end up in the situation where you forget to update a dependency in all of the crate Cargo.tomls (as seems to have happened with heapless-bytes)
This is a new feature of heapless 0.9, which allows to use a smaller size type to save space.
MathiasKoch
added a commit
that referenced
this pull request
Apr 7, 2026
* Update embedded-io to 0.7.0 * Implement Display and Error traits for IoError and Error enums * Update dependencies and improve serialization tests * add logging to from_slice (#251) * implement AtatLen for NonZero<T> (#252) with select values for T, since it is currently unstable to implement traits on a generic NonZero<T>. * fix serialization of None option in middle of struct fields (#234) (#253) serialize_none() unconditionally removed the last written byte, which worked for a single-field struct (removing '=') but broke multi-field structs by eating the ',' delimiter before a middle None field. Now serialize_none() only removes the separator when it is the '=' sign (first field of a top-level struct with value_sep enabled). Commas for non-first fields are preserved, producing empty delimited fields (e.g. AT+CMD=0,,1). SerializeStruct now tracks the buffer position after the last field that wrote content. In end(), written is restored to that position before appending the termination, stripping trailing commas from trailing None fields. * Fix: Handle all escape characters (#245) * handle all escape characters * cargo fmt * bump heapless and embassy * bump embassy and heapless * add ESCAPED_LEN to AtatLen for escape-aware buffer sizing Add ESCAPED_LEN associated constant to the AtatLen trait so commands with escape_strings=true use worst-case 3x buffer for string fields, while non-escaping commands keep the original sizing. Also fix all clippy warnings across the workspace including tests. --------- Co-authored-by: Kenneth Sylvest Knudsen <ksk@factbird.com> Co-authored-by: Mathias <mk@factbird.com> * Implement `AtatLen` with heapless `LenT` (#254) * update heapless-bytes version and promote to workspace-dependency I think that it may be nicer to have dependency versions declared in the workspace Cargo.toml. That way, you don't end up in the situation where you forget to update a dependency in all of the crate Cargo.tomls (as seems to have happened with heapless-bytes) * impl AtatLen for generic LenT parameter in heapless String and Vec This is a new feature of heapless 0.9, which allows to use a smaller size type to save space. * Update embedded-io to 0.7.0 * Implement Display and Error traits for IoError and Error enums * Update dependencies and improve serialization tests * Update embassy deps to released crates.io versions, drop [patch] section - Remove [patch.crates-io] git overrides now that embassy 0.10.0 is released - embassy-sync: 0.7.2 → 0.8.0 - embassy-executor: 0.9.1 → 0.10.0 (arch-cortex-m → platform-cortex-m feature) - embassy-rp: 0.9.0 → 0.10.0 - atat/defmt feature: add heapless/defmt (available since heapless 0.9.2) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Restore workspace dependencies and remove unnecessary patch section * Refactor error handling to use `thiserror`, cleanup redundant implementations --------- Co-authored-by: Johann Carl Meyer <info@johannc.de> Co-authored-by: Mathias Koch <mk@blackbird.online> Co-authored-by: Kenneth Knudsen <98805797+KennethKnudsen97@users.noreply.github.com> Co-authored-by: Kenneth Sylvest Knudsen <ksk@factbird.com> Co-authored-by: Mathias <mk@factbird.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
heapless 0.9 supports different len types now (besides usize) on vec / string, which saves space if you know that you will have a short vec / string.
AtatLenis currently only implemented forLenT = usize, so I've implemented the trait forthe generic case. That is the main goal of this PR.
While implementing, I've discovered that you had two heapless-bytes versions in the dependency tree (0.3 and 0.4). I've updated both to 0.5 (which matches with the new heapless 0.9 version). Also, I've promoted heapless and heapless-bytes to workspace dependencies, to prevent that version drift between crates from happening again.