Skip to content

Remove std dependencies from aimdb-sync - #204

Merged
lxsaah merged 3 commits into
aimdb-dev:mainfrom
solus161:feat/aimdb_sync_remove_std_deps
Jul 24, 2026
Merged

Remove std dependencies from aimdb-sync#204
lxsaah merged 3 commits into
aimdb-dev:mainfrom
solus161:feat/aimdb_sync_remove_std_deps

Conversation

@solus161

Copy link
Copy Markdown
Contributor

Description

What's new:

  • thiserror to 2.x
  • Use alloc::string::String instead of std::string::String
  • Use log_* instead of eprintln!
  • Use SyncResult in doctest

What's still not working:

  • Warning not show up in examples/sync-api-demo, possibly due to missing tracing feature in packgage's Cargo.toml and Drop behavior not executed

Related Issue

Checklist

  • I have read the CONTRIBUTING.md document.
  • My code follows the project's coding standards.
  • I have added tests to cover my changes.
  • All new and existing tests passed (make check).
  • I have updated the documentation accordingly.

What's new:
- `thiserror` to 2.x
- Use alloc::string::String instead of std::string::String
- Use `log_*` instead of `eprintln!`
- Use `SyncResult` in doctest

What's still not working:
- Warning not show up in `examples/sync-api-demo`, possibly due to
missing `tracing` feature and `Drop` behavior not executed
@solus161
solus161 requested a review from lxsaah as a code owner July 23, 2026 13:41

@lxsaah lxsaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling #197, eprintln! to log-facade routing and doctest conversion all look correct.

Two things before merge: the set_value doctest in aimdb-sync/src/producer.rs (line 251) needs use aimdb_sync::{AimDbBuilderSyncExt, SyncResult}; instead of just AimDbBuilderSyncExt, otherwise cargo test --doc --features data-contracts fails with "cannot find type SyncResult". To satisfy the verification step in #197, please also restore the drop-without-detach warning in sync-api-demo by enabling aimdb-sync's tracing feature plus a tracing-subscriber dependency and a tracing_subscriber::fmt::init(); call in main, since the log facade is a no-op without a subscriber.

solus161 and others added 2 commits July 24, 2026 18:03
- Add missing SyncResult in `aimdb-sync/src/producer.rs`
- Add `tracing` and `tracing-subscriber` to `examples/sync-api-demo`
- Add `graceful-shutdown` feature for `examples/sync-api-demo` so
`log_warn!` could surface
@solus161
solus161 requested a review from lxsaah July 24, 2026 12:41

@lxsaah lxsaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Thanks

@lxsaah
lxsaah merged commit 136a98e into aimdb-dev:main Jul 24, 2026
8 checks passed
@solus161
solus161 deleted the feat/aimdb_sync_remove_std_deps branch July 24, 2026 13:39
lxsaah added a commit to solus161/aimdb that referenced this pull request Jul 29, 2026
Follow-on to the review of aimdb-dev#205, applied directly to avoid another
round-trip.

- consumer.rs: drop the last 4 inert `#[cfg(feature = "std")]` guards in
  doc examples. `mod consumer` is already std-gated at lib.rs:257, so
  they can never evaluate false. The one on `get_with_timeout` was also
  missing the `# ` hide prefix and rendered into the published docs.
- consumer.rs: backtick `Arc<Mutex>` in a doc comment — it was the last
  `cargo doc` warning (unclosed HTML tag), pre-existing from before aimdb-dev#204.
- Makefile: add the no_std clippy arm and the thumbv7em-none-eabihf
  check, matching the per-crate convention. The cross-compile lane is
  the only one that catches std arriving through a dependency's default
  features; a host `--no-default-features` build passes regardless
  because the host has std, which is why CI was green while the no_std
  path was broken.
- Makefile: drop `--lib` from the no_std test arm. The conditional
  ```ignore fence added in 71102d8 means the full command now passes, so
  the arm covers unit tests, integration tests and doctests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lxsaah added a commit that referenced this pull request Jul 29, 2026
* Add std feature gate and no_std clip

What's new:
- tokio-related features are now optional;
- Update `lib.rs` to gate `std` at module level for `consumer.rs`,
`handle.rs`, and `producer.rs` as most units are depend on `std`
dependencies at the moment. Will gate at finer level in the futures;
- Add build with no default feature in Makefile

* Update aimdb-sync/Cargo.toml

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/src/lib.rs

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/Cargo.toml

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/src/consumer.rs

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/src/consumer.rs

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/src/handle.rs

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/src/handle.rs

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/src/producer.rs

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update aimdb-sync/src/handle.rs

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update Makefile

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>

* Update changes in no diff

What's new:
- Gate 'lib.rs` internal doctest with conditional `no_run` and `ignore`
so `cargo test -p aimdb-sync --no-default-features --doc` does not fail
- Several small reverted `std` guard as modules is now std-gated at
`lib.rs`

* Complete the no_std review sweep for aimdb-sync

Follow-on to the review of #205, applied directly to avoid another
round-trip.

- consumer.rs: drop the last 4 inert `#[cfg(feature = "std")]` guards in
  doc examples. `mod consumer` is already std-gated at lib.rs:257, so
  they can never evaluate false. The one on `get_with_timeout` was also
  missing the `# ` hide prefix and rendered into the published docs.
- consumer.rs: backtick `Arc<Mutex>` in a doc comment — it was the last
  `cargo doc` warning (unclosed HTML tag), pre-existing from before #204.
- Makefile: add the no_std clippy arm and the thumbv7em-none-eabihf
  check, matching the per-crate convention. The cross-compile lane is
  the only one that catches std arriving through a dependency's default
  features; a host `--no-default-features` build passes regardless
  because the host has std, which is why CI was green while the no_std
  path was broken.
- Makefile: drop `--lib` from the no_std test arm. The conditional
  ```ignore fence added in 71102d8 means the full command now passes, so
  the arm covers unit tests, integration tests and doctests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Add data-contracts CI lanes for aimdb-sync

`aimdb-sync/data-contracts` had no coverage in any make target, so
tests/settable_integration.rs and the `set_value` doctest never compiled
in CI. No consumer enables the feature either, so nothing reached it
transitively.

Adds a test arm and a clippy arm, matching the per-feature-combination
convention aimdb-client uses. The test arm picks up 4 integration tests
and a 26th doctest that were previously invisible.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Gate WASM cancel machinery on wasm-runtime

`bindings` (lib.rs:39) is the only consumer of CancelToken/CancelHandle
and is itself `#[cfg(feature = "wasm-runtime")]`, so the host test lanes
(`--no-default-features`) compiled these items with no reachable caller
and emitted 6 dead_code warnings. Gating them on the same feature as
their consumer keeps the two in step.

`Cell` was used only by CancelInner, so it moves behind the same gate to
avoid trading dead_code for unused_imports; `RefCell` stays unconditional.

Not dead code — the wasm32 path is unchanged and still compiles clean
with -D warnings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: sounds.like.lx <147444674+lxsaah@users.noreply.github.com>
Co-authored-by: Alexander Schnörch <alexander.schnoerch@outlook.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants