Rename crate to mytheclipse and flatten workspace to single crate
- Rename corex -> mytheclipse (corex name taken on crates.io by an unrelated crate published by David-Kunz in 2023) - Flatten corex + corex-core workspace into a single crate; all modules (context/error/io/compute/bg) now live directly under src/ - Update Cargo.toml metadata: real repo URL, docs.rs, author - Update README, example, doc comments, tracing span names - Fix CI: single package dry-run (corex-core no longer separate) - Fix publish workflow: single cargo publish step
This commit is contained in:
@@ -29,9 +29,9 @@ jobs:
|
||||
with:
|
||||
components: clippy
|
||||
- name: Clippy (all features)
|
||||
run: cargo clippy --workspace --all-features -- -D warnings
|
||||
run: cargo clippy --all-features -- -D warnings
|
||||
- name: Clippy (no default features)
|
||||
run: cargo clippy --workspace --no-default-features -- -D warnings
|
||||
run: cargo clippy --no-default-features -- -D warnings
|
||||
|
||||
test-matrix:
|
||||
name: Test (${{ matrix.name }})
|
||||
@@ -54,9 +54,9 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Build
|
||||
run: cargo build --workspace ${{ matrix.flags }}
|
||||
run: cargo build --all-targets ${{ matrix.flags }}
|
||||
- name: Test
|
||||
run: cargo test --workspace ${{ matrix.flags }}
|
||||
run: cargo test ${{ matrix.flags }}
|
||||
|
||||
example:
|
||||
name: Run example
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps
|
||||
- run: RUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-deps
|
||||
|
||||
package:
|
||||
name: Cargo package dry-run
|
||||
@@ -80,7 +80,5 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Package corex-core
|
||||
run: cargo package -p corex-core --no-verify
|
||||
- name: Package corex
|
||||
run: cargo package -p corex --no-verify
|
||||
- name: Package
|
||||
run: cargo package --no-verify
|
||||
@@ -11,13 +11,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: Publish corex-core
|
||||
run: cargo publish -p corex-core --allow-dirty --no-verify
|
||||
- name: Publish mytheclipse
|
||||
run: cargo publish --allow-dirty --no-verify
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
- name: Wait for crates.io indexing
|
||||
run: sleep 30
|
||||
- name: Publish corex
|
||||
run: cargo publish -p corex --allow-dirty --no-verify
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
+1
-7
@@ -1,15 +1,9 @@
|
||||
# Cargo build artifacts
|
||||
/target
|
||||
/crates/*/target
|
||||
|
||||
# corex is a library workspace: the lockfile is not committed, per Rust's
|
||||
# convention for libraries (binaries/applications should commit theirs).
|
||||
# Cargo regenerates it locally and in CI on every build.
|
||||
Cargo.lock
|
||||
|
||||
# Editor / OS noise
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*.swp
|
||||
.idea/
|
||||
.vscode/
|
||||
.vscode/
|
||||
Generated
+408
@@ -0,0 +1,408 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.189"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mytheclipse"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"num_cpus",
|
||||
"rayon",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
|
||||
dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.119"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "3.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
|
||||
dependencies = [
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
|
||||
dependencies = [
|
||||
"nu-ansi-term",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
+19
-41
@@ -1,57 +1,35 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["crates/corex-core"]
|
||||
|
||||
[workspace.package]
|
||||
[package]
|
||||
name = "mytheclipse"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.75"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/username/corex"
|
||||
homepage = "https://github.com/username/corex"
|
||||
documentation = "https://docs.rs/corex"
|
||||
authors = ["The corex Authors"]
|
||||
|
||||
[workspace.dependencies]
|
||||
tokio = { version = "1.53", features = ["full"] }
|
||||
rayon = "1.12"
|
||||
num_cpus = "1.17"
|
||||
tracing = "0.1"
|
||||
corex-core = { path = "crates/corex-core", version = "0.1.0", default-features = false }
|
||||
|
||||
[package]
|
||||
name = "corex"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
authors.workspace = true
|
||||
repository = "https://github.com/asepharyana/corex"
|
||||
homepage = "https://github.com/asepharyana/corex"
|
||||
documentation = "https://docs.rs/mytheclipse"
|
||||
authors = ["asepharyana <superaseph@gmail.com>"]
|
||||
description = "Resource-aware abstractions for async I/O, heavy compute, and background queue management."
|
||||
readme = "README.md"
|
||||
keywords = ["async", "concurrency", "rayon", "tokio", "resource-management"]
|
||||
categories = ["asynchronous", "concurrency", "rust-patterns"]
|
||||
|
||||
[lib]
|
||||
name = "corex"
|
||||
path = "src/lib.rs"
|
||||
[dependencies]
|
||||
tokio = { version = "1.53", features = ["full"], optional = true }
|
||||
rayon = { version = "1.12", optional = true }
|
||||
num_cpus = "1.17"
|
||||
tracing = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1.53", features = ["full"] }
|
||||
tracing-subscriber = "0.3"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
io = ["corex-core/io"]
|
||||
compute = ["corex-core/compute"]
|
||||
bg = ["corex-core/bg"]
|
||||
io = ["dep:tokio"]
|
||||
compute = ["dep:rayon"]
|
||||
bg = ["dep:tokio"]
|
||||
full = ["io", "compute", "bg"]
|
||||
|
||||
[dependencies]
|
||||
corex-core = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true }
|
||||
tracing-subscriber = "0.3"
|
||||
|
||||
[[example]]
|
||||
name = "main"
|
||||
path = "examples/main.rs"
|
||||
@@ -59,4 +37,4 @@ required-features = ["full"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
@@ -1,7 +1,7 @@
|
||||
# corex
|
||||
# mytheclipse
|
||||
|
||||
[](https://crates.io/crates/corex)
|
||||
[](https://docs.rs/corex)
|
||||
[](https://crates.io/crates/mytheclipse)
|
||||
[](https://docs.rs/mytheclipse)
|
||||
[](LICENSE-MIT)
|
||||
|
||||
Resource-aware execution primitives for Rust: async I/O, heavy compute, and background queue management, sized automatically from the host's logical core count and exposed through a single, lazily-initialized engine context.
|
||||
@@ -18,9 +18,9 @@ Given $N$ logical cores (via `num_cpus::get()`):
|
||||
|
||||
## Features
|
||||
|
||||
- **`io`**: enables `corex::spawn_io`, instrumented async task spawning.
|
||||
- **`compute`**: enables `corex::compute`, panic-isolated execution on a sized Rayon pool.
|
||||
- **`bg`**: enables `corex::spawn_bg`, semaphore-bounded background tasks.
|
||||
- **`io`**: enables `mytheclipse::spawn_io`, instrumented async task spawning.
|
||||
- **`compute`**: enables `mytheclipse::compute`, panic-isolated execution on a sized Rayon pool.
|
||||
- **`bg`**: enables `mytheclipse::spawn_bg`, semaphore-bounded background tasks.
|
||||
- **`full`**: enables all three subsystems.
|
||||
|
||||
Zero features enabled by default (`default = []`), so you only pull in the dependencies your application actually uses.
|
||||
@@ -31,7 +31,7 @@ Add to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
corex = { version = "0.1", features = ["full"] }
|
||||
mytheclipse = { version = "0.1", features = ["full"] }
|
||||
```
|
||||
|
||||
Use the entry points directly:
|
||||
@@ -41,23 +41,23 @@ Use the entry points directly:
|
||||
async fn main() {
|
||||
// Optional explicit bootstrap: logs or validates resource sizing upfront.
|
||||
// Omit it and the first call to any primitive below will initialize it lazily.
|
||||
let ctx = corex::init();
|
||||
let ctx = mytheclipse::init();
|
||||
println!(
|
||||
"io_threads={} compute_threads={} bg_concurrency={}",
|
||||
ctx.io_threads, ctx.compute_threads, ctx.bg_concurrency
|
||||
);
|
||||
|
||||
// 1. Async I/O (instrumented with tracing)
|
||||
let io = corex::spawn_io(async {
|
||||
let io = mytheclipse::spawn_io(async {
|
||||
// ... network / disk work ...
|
||||
42
|
||||
});
|
||||
|
||||
// 2. Heavy Compute (isolated from worker panics)
|
||||
let sum = corex::compute(|| (1..=1_000_000u64).sum::<u64>())?;
|
||||
let sum = mytheclipse::compute(|| (1..=1_000_000u64).sum::<u64>())?;
|
||||
|
||||
// 3. Background Queue (concurrency-bounded)
|
||||
let bg = corex::spawn_bg(async {
|
||||
let bg = mytheclipse::spawn_bg(async {
|
||||
// ... deferred cleanup / telemetry ...
|
||||
}).await;
|
||||
|
||||
@@ -78,4 +78,4 @@ Licensed under either of:
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
|
||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
||||
|
||||
at your option.
|
||||
at your option.
|
||||
@@ -1,31 +0,0 @@
|
||||
[package]
|
||||
name = "corex-core"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Core allocation logic and execution primitives for corex."
|
||||
readme = "README.md"
|
||||
keywords = ["async", "concurrency", "rayon", "tokio", "resource-management"]
|
||||
categories = ["asynchronous", "concurrency", "rust-patterns"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
io = ["dep:tokio"]
|
||||
compute = ["dep:rayon"]
|
||||
bg = ["dep:tokio"]
|
||||
full = ["io", "compute", "bg"]
|
||||
|
||||
[dependencies]
|
||||
tokio = { workspace = true, optional = true }
|
||||
rayon = { workspace = true, optional = true }
|
||||
num_cpus = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
@@ -1,9 +0,0 @@
|
||||
# corex-core
|
||||
|
||||
Core allocation logic, global context initialization, and execution primitives for [`corex`](https://crates.io/crates/corex).
|
||||
|
||||
Applications should depend on the `corex` facade crate rather than this crate directly.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
|
||||
@@ -1,19 +0,0 @@
|
||||
//! Core allocation logic, global context initialization, and execution
|
||||
//! primitives for [corex](https://docs.rs/corex).
|
||||
//!
|
||||
//! This crate is not typically consumed directly; applications should
|
||||
//! depend on the `corex` facade crate instead, which re-exports the pieces
|
||||
//! of this crate behind feature flags.
|
||||
|
||||
pub mod context;
|
||||
#[cfg(feature = "compute")]
|
||||
pub mod error;
|
||||
|
||||
#[cfg(feature = "io")]
|
||||
pub mod io;
|
||||
|
||||
#[cfg(feature = "compute")]
|
||||
pub mod compute;
|
||||
|
||||
#[cfg(feature = "bg")]
|
||||
pub mod bg;
|
||||
+7
-7
@@ -1,30 +1,30 @@
|
||||
//! Demonstrates `corex`'s three execution primitives end to end, including
|
||||
//! Demonstrates `mytheclipse`'s three execution primitives end to end, including
|
||||
//! automatic recovery from a panicking compute closure.
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let ctx = corex::init();
|
||||
let ctx = mytheclipse::init();
|
||||
println!(
|
||||
"engine context: io_threads={} compute_threads={} bg_concurrency={}",
|
||||
ctx.io_threads, ctx.compute_threads, ctx.bg_concurrency
|
||||
);
|
||||
|
||||
let io_handle = corex::spawn_io(async {
|
||||
let io_handle = mytheclipse::spawn_io(async {
|
||||
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
|
||||
42u64
|
||||
});
|
||||
|
||||
let sum_result = corex::compute(|| (1..=1_000u64).sum::<u64>());
|
||||
let sum_result = mytheclipse::compute(|| (1..=1_000u64).sum::<u64>());
|
||||
|
||||
let panic_result: Result<u64, corex::CorexError> = corex::compute(|| {
|
||||
let panic_result: Result<u64, mytheclipse::CorexError> = mytheclipse::compute(|| {
|
||||
panic!("intentional panic to demonstrate isolation");
|
||||
});
|
||||
|
||||
let recovery_result = corex::compute(|| 2u64 + 2u64);
|
||||
let recovery_result = mytheclipse::compute(|| 2u64 + 2u64);
|
||||
|
||||
let bg_handle = corex::spawn_bg(async {
|
||||
let bg_handle = mytheclipse::spawn_bg(async {
|
||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||
"bg-task-done"
|
||||
})
|
||||
|
||||
@@ -30,8 +30,8 @@ where
|
||||
.bg_semaphore
|
||||
.acquire()
|
||||
.await
|
||||
.expect("corex: bg semaphore closed unexpectedly");
|
||||
let span = tracing::info_span!("corex_bg_task");
|
||||
.expect("mytheclipse: bg semaphore closed unexpectedly");
|
||||
let span = tracing::info_span!("mytheclipse_bg_task");
|
||||
tokio::spawn(
|
||||
async move {
|
||||
let _permit = permit;
|
||||
@@ -10,7 +10,7 @@ static CONTEXT: OnceLock<EngineContext> = OnceLock::new();
|
||||
|
||||
/// The global, lazily-initialized engine context.
|
||||
///
|
||||
/// Holds the computed thread and concurrency counts for each corex
|
||||
/// Holds the computed thread and concurrency counts for each mytheclipse
|
||||
/// subsystem, along with the resource pools those counts were used to
|
||||
/// build. The context lives for the lifetime of the process once
|
||||
/// initialized: it is stored in a `'static` [`OnceLock`] and is never
|
||||
@@ -46,9 +46,9 @@ impl EngineContext {
|
||||
#[cfg(feature = "compute")]
|
||||
let compute_pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(compute_threads)
|
||||
.thread_name(|index| format!("corex-compute-{index}"))
|
||||
.thread_name(|index| format!("mytheclipse-compute-{index}"))
|
||||
.build()
|
||||
.expect("corex: failed to build rayon compute thread pool");
|
||||
.expect("mytheclipse: failed to build rayon compute thread pool");
|
||||
|
||||
#[cfg(feature = "bg")]
|
||||
let bg_semaphore = tokio::sync::Semaphore::new(bg_concurrency);
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Shared error type for corex execution primitives.
|
||||
//! Shared error type for mytheclipse execution primitives.
|
||||
|
||||
/// Errors surfaced by corex's panic-isolated execution primitives.
|
||||
/// Errors surfaced by mytheclipse's panic-isolated execution primitives.
|
||||
///
|
||||
/// Marked `#[non_exhaustive]` so new variants can be added without a
|
||||
/// breaking change; downstream `match` expressions should include a
|
||||
@@ -3,11 +3,11 @@
|
||||
use tracing::Instrument;
|
||||
|
||||
/// Spawns `future` onto the ambient Tokio runtime, wrapped in a
|
||||
/// `corex_io_task` tracing span.
|
||||
/// `mytheclipse_io_task` tracing span.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if called outside the context of a running Tokio runtime; corex
|
||||
/// Panics if called outside the context of a running Tokio runtime; mytheclipse
|
||||
/// does not construct or own a runtime of its own, it schedules onto
|
||||
/// whichever runtime the caller is already inside.
|
||||
pub fn spawn_io<F>(future: F) -> tokio::task::JoinHandle<F::Output>
|
||||
@@ -15,7 +15,7 @@ where
|
||||
F: std::future::Future + Send + 'static,
|
||||
F::Output: Send + 'static,
|
||||
{
|
||||
let span = tracing::info_span!("corex_io_task");
|
||||
let span = tracing::info_span!("mytheclipse_io_task");
|
||||
tokio::spawn(future.instrument(span))
|
||||
}
|
||||
|
||||
+25
-12
@@ -1,4 +1,4 @@
|
||||
//! # corex
|
||||
//! # mytheclipse
|
||||
//!
|
||||
//! Resource-aware abstractions for async I/O, heavy compute, and
|
||||
//! background queue management, built on a single lazily-initialized
|
||||
@@ -14,26 +14,39 @@
|
||||
//!
|
||||
//! Enable the `full` feature to pull in all three at once.
|
||||
|
||||
pub use corex_core::context::{context, EngineContext};
|
||||
|
||||
pub mod context;
|
||||
#[cfg(feature = "compute")]
|
||||
pub use corex_core::error::CorexError;
|
||||
pub mod error;
|
||||
|
||||
#[cfg(feature = "io")]
|
||||
pub use corex_core::io::spawn_io;
|
||||
pub mod io;
|
||||
|
||||
#[cfg(feature = "compute")]
|
||||
pub use corex_core::compute::compute;
|
||||
pub mod compute;
|
||||
|
||||
#[cfg(feature = "bg")]
|
||||
pub use corex_core::bg::spawn_bg;
|
||||
pub mod bg;
|
||||
|
||||
/// Bootstraps the global corex [`EngineContext`].
|
||||
pub use context::{context, EngineContext};
|
||||
|
||||
#[cfg(feature = "compute")]
|
||||
pub use error::CorexError;
|
||||
|
||||
#[cfg(feature = "io")]
|
||||
pub use io::spawn_io;
|
||||
|
||||
#[cfg(feature = "compute")]
|
||||
pub use compute::compute;
|
||||
|
||||
#[cfg(feature = "bg")]
|
||||
pub use bg::spawn_bg;
|
||||
|
||||
/// Bootstraps the global [`EngineContext`].
|
||||
///
|
||||
/// See [`corex_core::context::init`] for full semantics: this is safe to
|
||||
/// call any number of times, from any thread, and is equivalent to letting
|
||||
/// the first call to [`spawn_io`], [`compute`], or [`spawn_bg`] trigger
|
||||
/// See [`context::init`] for full semantics: this is safe to call any
|
||||
/// number of times, from any thread, and is equivalent to letting the
|
||||
/// first call to [`spawn_io`], [`compute`], or [`spawn_bg`] trigger
|
||||
/// initialization implicitly.
|
||||
pub fn init() -> &'static EngineContext {
|
||||
corex_core::context::init()
|
||||
context::init()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user