Naming: disambiguate the two blocking modules - #126
Merged
Conversation
Add an explicit `pub mod blocking` at the crate root that re-exports the blocking `Client`/`ClientBuilder`/`Paginator` (from `api::blocking`) alongside the generated sync endpoint wrappers. The explicit item shadows the glob-imported `generated::blocking`, so this is additive: existing paths (`datamaxi::api::blocking::*`, `datamaxi::blocking::CexCandle`) all still resolve, but sync callers now need only one module — mirroring the async crate root that holds `Client` + wrappers together. Drops the "you need both modules" story from crate/README docs.
Member
Author
|
Follow-up codegen issue for the residual "~200 generated names in the crate root" concern: #127 |
This was referenced Jul 15, 2026
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.
Part of #116 — the "two different
blockingmodules" item.Problem
pub use generated::*re-exportsgenerated::blocking(sync endpoint wrappers) asdatamaxi::blocking, sitting next to the unrelated hand-writtendatamaxi::api::blocking(Client/ClientBuilder/Paginator). The docs had to keep telling sync users to combine both paths, e.g. "datamaxi::blocking::CexCandleanddatamaxi::api::blocking".Approach chosen
Make
datamaxi::blockinga single, unified sync entry point rather than trying to rename anything.An explicit
pub mod blockinginlib.rsre-exports, in one place:Client/ClientBuilder/Paginatorfromapi::blocking, andpub use crate::generated::blocking::*).The explicit module shadows the glob-imported
generated::blocking(an item beats a glob binding of the same name — no conflict). This mirrors the async crate root, which already holdsClient+ the endpoint wrappers together, so sync users now write one import:use datamaxi::blocking::{Client, CexCandle};.Only the hand-written side is touched.
generated.rs(DO NOT EDIT) is untouched.Why not the alternatives
api::blocking— only the hand-written side is renameable, so a rename can't remove the otherblockingname; it would just add churn/breakage without fixing the core "need both" confusion.generated::blocking— requires the upstreamdatamaxi-codegentool; out of scope here.pub use generated::*— too breaking; it is the crate's canonical type surface (everydatamaxi::CexCandleResponseetc.). Kept as-is. The residual "~200 names in the crate root" concern is codegen-side and filed separately (see below).Breaking?
No. Purely additive. Every prior path still resolves:
datamaxi::blocking::CexCandle✓ (now via the unified module)datamaxi::api::blocking::Client✓ (unchanged home; also newly reachable asdatamaxi::blocking::Client)api::blockingbecomes the implementation home thatdatamaxi::blockingre-exports — exactly theapi::Client→datamaxi::Clientrelationship that already exists on the async side.Version implication
New public API surface (a new re-export path) ⇒ minor bump (0.12.0 → 0.13.0) at next release. Following repo convention (additive PRs #91/#106/#108/#119 didn't bump
Cargo.tomlthemselves), this PR does not touch the version.Follow-up
Filed a
claude-foundcodegen issue for the residual "~200 generated names in the crate root" concern (link added as a comment).Test plan
cargo fmt --all -- --check— cleancargo clippy --all-targets --all-features -- -D warnings— clean; also default-feature clippy cleancargo test --all-features— 44 unit + 7 doctests pass (incl. newdatamaxi::blockingdoctest)cargo doc --no-deps(default and--all-features) — no new warnings vs. baseline (verified by diffing warning counts; the pre-existingapi.rsintra-doc-link warnings are unrelated and untouched)DTMX_API_KEY(expected)