This is an automated email from the ASF dual-hosted git repository.

tisonkun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 1eb271e  chore: move examples into a standalone workspace crate (#374)
1eb271e is described below

commit 1eb271ee86a37a641c34359d4776c6fa23279bb1
Author: tison <[email protected]>
AuthorDate: Sun Nov 15 22:05:06 2026 +0800

    chore: move examples into a standalone workspace crate (#374)
---
 Cargo.lock                                         |  7 +++
 Cargo.toml                                         |  8 +++-
 README.md                                          |  2 +-
 datasketches/Cargo.toml                            |  4 --
 {datasketches/examples => examples}/AGENTS.md      |  2 +-
 {datasketches => examples}/Cargo.toml              | 51 ++++++++--------------
 .../examples => examples/src}/bloom_difference.rs  |  0
 7 files changed, 33 insertions(+), 41 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index bbf0663..6e5efe2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -256,6 +256,13 @@ dependencies = [
  "windows-sys 0.61.2",
 ]
 
+[[package]]
+name = "examples"
+version = "0.0.0"
+dependencies = [
+ "datasketches",
+]
+
 [[package]]
 name = "fastrand"
 version = "2.5.0"
diff --git a/Cargo.toml b/Cargo.toml
index bb36c89..ae16d63 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,13 @@
 # under the License.
 
 [workspace]
-members = ["benchmarks", "datasketches", "tests-integration", "xtask"]
+members = [
+  "benchmarks",
+  "datasketches",
+  "examples",
+  "tests-integration",
+  "xtask",
+]
 resolver = "3"
 
 [workspace.package]
diff --git a/README.md b/README.md
index 0e38d6b..e806897 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ Enable multiple algorithms by listing their features 
together, such as `features
 | `tuple`       | `TupleSketch` and set operations      | Theta-style keys 
with user-defined summaries attached to retained entries.                       
 |
 | `xor`         | `XorFilter`, `XorFilterBuilder`        | Immutable 
probabilistic membership with 8-, 16-, or 32-bit fingerprints.                  
         |
 
-See the [API documentation](https://docs.rs/datasketches) for configuration, 
accuracy guarantees, serialization, and examples for each algorithm. Runnable 
end-to-end scenarios live in [`datasketches/examples`](datasketches/examples).
+See the [API documentation](https://docs.rs/datasketches) for configuration, 
accuracy guarantees, serialization, and examples for each algorithm. Runnable 
end-to-end scenarios live in [`examples`](examples).
 
 ## Compatibility
 
diff --git a/datasketches/Cargo.toml b/datasketches/Cargo.toml
index adbbb84..621421f 100644
--- a/datasketches/Cargo.toml
+++ b/datasketches/Cargo.toml
@@ -50,10 +50,6 @@ theta = []
 tuple = []
 xor = []
 
-[[example]]
-name = "bloom_difference"
-required-features = ["bloom"]
-
 [dev-dependencies]
 googletest = { workspace = true }
 insta = { workspace = true }
diff --git a/datasketches/examples/AGENTS.md b/examples/AGENTS.md
similarity index 76%
rename from datasketches/examples/AGENTS.md
rename to examples/AGENTS.md
index c5c2448..f0d335e 100644
--- a/datasketches/examples/AGENTS.md
+++ b/examples/AGENTS.md
@@ -4,4 +4,4 @@
 - Omit run commands, basic Cargo instructions, and comments that merely 
restate the code. Assume readers know how to run a Rust example.
 - Keep each example focused on a small, coherent scenario. Explain relevant 
semantic differences beside the code; avoid catalogs of unrelated primitives.
 - Keep example explanations in the example source. The repository README only 
needs a concise entry point.
-- Register each example in `datasketches/Cargo.toml` with an explicit 
`[[example]]` section and its `required-features`, since every sketch feature 
is opt-in.
+- Register each example in `examples/Cargo.toml` with an explicit 
`[[example]]` section pointing to `src/<name>.rs`.
diff --git a/datasketches/Cargo.toml b/examples/Cargo.toml
similarity index 54%
copy from datasketches/Cargo.toml
copy to examples/Cargo.toml
index adbbb84..7fa6d7c 100644
--- a/datasketches/Cargo.toml
+++ b/examples/Cargo.toml
@@ -16,47 +16,30 @@
 # under the License.
 
 [package]
-name = "datasketches"
-version = "0.6.0"
+name = "examples"
+publish = false
 
 edition.workspace = true
-homepage.workspace = true
-license.workspace = true
-readme.workspace = true
-repository.workspace = true
 rust-version.workspace = true
 
-categories = ["data-structures", "algorithms"]
-description = "A software library of stochastic streaming algorithms (a.k.a. 
sketches)"
-keywords = ["sketch", "hyperloglog", "probabilistic"]
-
-[package.metadata.docs.rs]
-all-features = true
-rustdoc-args = ["--cfg", "docsrs"]
-
-[features]
-default = []
-
-# Each sketch has its own feature, so that users can opt in to only the 
sketches they need.
-bloom = []
-countmin = []
-cpc = []
-frequencies = []
-hll = []
-kll = []
-req = []
-tdigest = []
-theta = []
-tuple = []
-xor = []
+[dependencies]
+datasketches = { workspace = true, features = [
+  "bloom",
+  "countmin",
+  "cpc",
+  "frequencies",
+  "hll",
+  "kll",
+  "req",
+  "tdigest",
+  "theta",
+  "tuple",
+  "xor",
+] }
 
 [[example]]
 name = "bloom_difference"
-required-features = ["bloom"]
-
-[dev-dependencies]
-googletest = { workspace = true }
-insta = { workspace = true }
+path = "src/bloom_difference.rs"
 
 [lints]
 workspace = true
diff --git a/datasketches/examples/bloom_difference.rs 
b/examples/src/bloom_difference.rs
similarity index 100%
rename from datasketches/examples/bloom_difference.rs
rename to examples/src/bloom_difference.rs


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to