From 06f67c8c0e5363220ed9f74489458a2a3666bc4f Mon Sep 17 00:00:00 2001 From: kingchenc Date: Thu, 21 May 2026 20:36:57 +0200 Subject: [PATCH] Move Rust examples into their crates so cargo publish picks them up The previous `[[example]] path = "../../examples/rust/..."` entries pointed at files outside the crate root. cargo only packages files inside the crate directory, so the examples would have been silently dropped on publish. Moving them to crates/wickra/examples/ and crates/wickra-data/examples/ keeps them as part of the published package and lets cargo discover them automatically (no [[example]] override needed). README and project-layout section updated. --- README.md | 6 +++--- crates/wickra-data/Cargo.toml | 1 - .../rust => crates/wickra-data/examples}/live_binance.rs | 0 crates/wickra/Cargo.toml | 5 ----- {examples/rust => crates/wickra/examples}/backtest.rs | 0 5 files changed, 3 insertions(+), 9 deletions(-) rename {examples/rust => crates/wickra-data/examples}/live_binance.rs (100%) rename {examples/rust => crates/wickra/examples}/backtest.rs (100%) diff --git a/README.md b/README.md index c8f5488c..51734aa1 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ inherit it automatically. | Python (PyO3) | `pip install wickra` | `examples/python/backtest.py` | | Node.js (napi-rs) | `npm install wickra` | `bindings/node/__tests__/smoke.test.js` | | Browser / WASM | `npm install wickra-wasm` | `bindings/wasm/examples/index.html` | -| Rust | `cargo add wickra` | `examples/rust/backtest.rs` | +| Rust | `cargo add wickra` | `crates/wickra/examples/backtest.rs` | The wickra-core crate is `unsafe`-forbidden, so every binding inherits a memory-safe implementation. @@ -175,8 +175,8 @@ wickra/ │ ├── node/ napi-rs (publishes on npm) │ └── wasm/ wasm-bindgen (browsers, bundlers, Node) ├── examples/ -│ ├── python/ backtest, live trading, parallel assets, multi-tf -│ └── rust/ backtest, live Binance +│ └── python/ backtest, live trading, parallel assets, multi-tf +│ (Rust examples live inside their crate at crates//examples/) ├── benches/ cargo bench targets └── .github/workflows/ CI and release pipelines ``` diff --git a/crates/wickra-data/Cargo.toml b/crates/wickra-data/Cargo.toml index b7b233af..9d1772d7 100644 --- a/crates/wickra-data/Cargo.toml +++ b/crates/wickra-data/Cargo.toml @@ -41,5 +41,4 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] } [[example]] name = "live_binance" -path = "../../examples/rust/live_binance.rs" required-features = ["live-binance"] diff --git a/examples/rust/live_binance.rs b/crates/wickra-data/examples/live_binance.rs similarity index 100% rename from examples/rust/live_binance.rs rename to crates/wickra-data/examples/live_binance.rs diff --git a/crates/wickra/Cargo.toml b/crates/wickra/Cargo.toml index 783655c2..c4b185da 100644 --- a/crates/wickra/Cargo.toml +++ b/crates/wickra/Cargo.toml @@ -31,8 +31,3 @@ wickra-data = { path = "../wickra-data" } [[bench]] name = "indicators" harness = false - -[[example]] -name = "backtest" -path = "../../examples/rust/backtest.rs" -required-features = [] diff --git a/examples/rust/backtest.rs b/crates/wickra/examples/backtest.rs similarity index 100% rename from examples/rust/backtest.rs rename to crates/wickra/examples/backtest.rs