Skip to content

Commit b0109d7

Browse files
Merge branch 'main' into deferred-system-kind
2 parents eead8b7 + a8be639 commit b0109d7

202 files changed

Lines changed: 33272 additions & 16886 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
env:
44
# When changing this, also update the `rust-version` in the workspace `Cargo.toml`
5-
RUST_MIN_VER: "1.82"
5+
RUST_MIN_VER: "1.85"
66

77
on:
88
push:
@@ -59,6 +59,7 @@ jobs:
5959
name: cargo build + clippy (iOS)
6060
env:
6161
RUSTFLAGS: -Dwarnings
62+
IPHONEOS_DEPLOYMENT_TARGET: "15.0"
6263
steps:
6364
- uses: actions/checkout@v4
6465
- name: install stable toolchain
@@ -72,6 +73,28 @@ jobs:
7273
- name: cargo clippy
7374
run: cargo clippy --target aarch64-apple-ios --all-targets --workspace
7475

76+
build-musl:
77+
runs-on: ubuntu-latest
78+
name: cargo build + test (musl)
79+
env:
80+
RUSTFLAGS: -Dwarnings
81+
steps:
82+
- uses: actions/checkout@v4
83+
- name: install stable toolchain
84+
uses: dtolnay/rust-toolchain@master
85+
with:
86+
toolchain: stable
87+
components: clippy
88+
targets: x86_64-unknown-linux-musl
89+
- name: Install musl tools
90+
run: sudo apt-get install -y musl-tools
91+
- name: cargo build
92+
run: cargo build --target x86_64-unknown-linux-musl --all-targets --workspace
93+
- name: cargo clippy
94+
run: cargo clippy --target x86_64-unknown-linux-musl --all-targets --workspace
95+
- name: cargo test
96+
run: cargo test --target x86_64-unknown-linux-musl --workspace --features test-with-crash-handler
97+
7598
build-msrv:
7699
runs-on: ubuntu-latest
77100
name: cargo build (MSRV)
@@ -96,6 +119,9 @@ jobs:
96119
- uses: dtolnay/rust-toolchain@master
97120
with:
98121
toolchain: nightly
99-
- uses: dtolnay/install@cargo-docs-rs
122+
123+
# Compile cargo-docs-rs locally so it links against the runner's glibc.
124+
- run: cargo install cargo-docs-rs --locked
125+
100126
- run: cargo docs-rs -p flecs_ecs
101-
- run: cargo docs-rs -p flecs_ecs_derive
127+
- run: cargo docs-rs -p flecs_ecs_derive

.github/workflows/deploy-book.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy mdBook
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Setup mdBook
20+
uses: peaceiris/actions-mdbook@v1
21+
with:
22+
mdbook-version: 'latest'
23+
24+
- name: Install mdbook-admonish
25+
uses: taiki-e/install-action@v2
26+
with:
27+
tool: mdbook-admonish
28+
29+
- name: Build Book
30+
run: |
31+
cd flecs_ecs/doc/flecs
32+
mdbook build
33+
34+
- name: Deploy
35+
uses: peaceiris/actions-gh-pages@v3
36+
if: ${{ github.ref == 'refs/heads/main' }}
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
publish_dir: ./flecs_ecs/doc/flecs/book

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ rustfmt.toml
77
flecs_ecs/src/main.rs
88
flecs_ecs_test/
99
flecs_ecs/benches/fbench_log/
10-
flecs_ecs/src/old_cached_code/
10+
flecs_ecs/src/old_cached_code/
11+
flecs_ecs/doc/flecs/docreplace
12+
flecs_ecs/doc/flecs/book/
13+
flecs_ecs/doc/flecs/src/cheatsheet.md
14+
docreplace/

Cargo.toml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,41 @@ members = ["flecs_ecs", "flecs_ecs_derive", "flecs_ecs_sys", "test_crash_handler
33
resolver = "2"
44

55
exclude = [
6-
"flecs_ecs_test"
6+
"flecs_ecs_test",
7+
"docreplace"
78
]
89

910
[workspace.package]
1011
edition = "2021"
1112
license = "MIT"
1213
repository = "https://github.com/Indra-db/Flecs-Rust"
1314
# When changing this, update the CI as well.
14-
rust-version = "1.82"
15+
rust-version = "1.85"
16+
17+
[workspace.lints.clippy]
18+
doc_markdown = "warn"
19+
float_cmp = "warn"
20+
float_cmp_const = "warn"
21+
print_stderr = "warn"
22+
print_stdout = "warn"
23+
semicolon_if_nothing_returned = "warn"
24+
manual_let_else = "warn"
25+
redundant_closure_for_method_calls = "warn"
26+
redundant_else = "warn"
27+
unwrap_or_default = "warn"
28+
too_many_arguments = "allow"
29+
std_instead_of_core = "warn"
30+
std_instead_of_alloc = "warn"
31+
alloc_instead_of_core = "warn"
1532

1633
[workspace.lints]
17-
clippy.doc_markdown = "warn"
18-
clippy.float_cmp = "warn"
19-
clippy.float_cmp_const = "warn"
20-
clippy.print_stderr = "warn"
21-
clippy.print_stdout = "warn"
22-
clippy.semicolon_if_nothing_returned = "warn"
2334
rust.unused_lifetimes = "warn"
2435

2536
[workspace.dependencies]
2637
flecs_ecs = { version = "0.1.2", path = "flecs_ecs" }
2738
flecs_ecs_derive = { version = "0.1.0", path = "flecs_ecs_derive" }
2839
flecs_ecs_sys = { version = "0.1.2", path = "flecs_ecs_sys" }
40+
libc = "0.2.169"
2941

3042
[profile.release]
3143
lto = true

Makefile.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,32 @@ command = "rustup"
7878
args = ["run", "nightly", "cargo", "fmt", "--", "--config", "format_code_in_doc_comments=true"]
7979
workspace = false
8080

81+
[tasks.test-book]
82+
description = "Test the flecs rust book"
83+
command = "mdbook"
84+
args = ["test", "flecs_ecs/doc/flecs", "--library-path", "target/debug/deps"]
85+
workspace = false
86+
87+
[tasks.install-mdbook]
88+
install_crate = { crate_name = "mdbook", binary = "mdbook", test_arg = "--version" }
89+
90+
[tasks.install-mdbook-admonish]
91+
install_crate = { crate_name = "mdbook-admonish", binary = "mdbook-admonish", test_arg = "--version" }
92+
93+
[tasks.install-book-deps]
94+
dependencies = [
95+
"install-mdbook",
96+
"install-mdbook-admonish"
97+
]
98+
99+
[tasks.build-book]
100+
dependencies = ["install-book-deps"]
101+
cwd = "./flecs_ecs/doc/flecs"
102+
command = "mdbook"
103+
args = ["build"]
81104

105+
[tasks.serve-book]
106+
dependencies = ["install-book-deps"]
107+
cwd = "./flecs_ecs/doc/flecs"
108+
command = "mdbook"
109+
args = ["serve", "--open"]

README.md

Lines changed: 1 addition & 1 deletion

_typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ extend-exclude = [
33
"flecs_ecs_sys/**/*",
44
"target/**/*",
55
"flecs_ecs/examples/flecs/z_ignore_test_snapshots/**/*",
6+
"flecs_ecs/doc/flecs/theme/**/*",
7+
"flecs_ecs/doc/flecs/book/**/*",
68
]
79

810
[default.extend-words]

flecs_ecs/Cargo.toml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
2323
[dependencies]
2424
flecs_ecs_derive = { workspace = true }
2525
flecs_ecs_sys = { workspace = true }
26-
bitflags = "2.6.0"
27-
compact_str = "0.8.0"
28-
hashbrown = "0.15.0"
26+
bitflags = "2.8.0"
27+
compact_str = { version = "0.9.0", default-features = false }
28+
hashbrown = "0.15.2"
2929

3030
# used for backtraces upon hardware exceptions during test
3131
# only used when "test-with-crash-handler" feature enabled
@@ -34,18 +34,22 @@ test_crash_handler = { version = "0.1.0", path = "../test_crash_handler", option
3434
[dev-dependencies]
3535
criterion = "0.5.1"
3636
seq-macro = "0.3.5"
37-
rand = "0.8.5"
38-
ctor = "0.2.7"
39-
insta = { version = "1.38.0", features = ["yaml","filters"] }
37+
rand = "0.9.0"
38+
ctor = "0.4.0"
39+
insta = { version = "1.42.1", features = ["yaml","filters"] }
40+
libc.workspace = true
4041
# used for capturing stdout in the examples test cases. Works only on Nightly, meant
4142
# to be used with flecs_nightly_tests feature flag
4243
#capture-stdio = "0.1.1"
4344

44-
[features]
45+
[features]
4546
######################
4647
# sys feature flags
4748
######################
4849

50+
# use std
51+
std = ["flecs_ecs_derive/std", "compact_str/std"]
52+
4953
# Regenerate the C binding for flecs C
5054
flecs_regenerate_binding_c = ["flecs_ecs_sys/regenerate_binding"]
5155

@@ -72,6 +76,9 @@ flecs_disable_build_c = ["flecs_ecs_sys/disable_build_c"]
7276
# Flecs feature flags
7377
######################
7478

79+
# Enable query trait for Rust
80+
flecs_query_rust_traits = ["flecs_ecs_derive/flecs_query_rust_traits"]
81+
7582
# Enable flecs performance tracing
7683
flecs_perf_trace = ["flecs_ecs_sys/flecs_perf_trace"]
7784

@@ -149,27 +156,35 @@ flecs_nightly_tests = []
149156
# enable a backtrace on crashes during tests, used for e.g. debugging intermittent CI failures
150157
test-with-crash-handler = ["dep:test_crash_handler", "test_crash_handler/crash-handler"]
151158

159+
# most common base features
160+
flecs_base = [
161+
# this is commented since `no_std` is not ready yet
162+
"std",
163+
"flecs_module",
164+
"flecs_system",
165+
"flecs_pipeline",
166+
"flecs_timer",
167+
"flecs_os_api_impl",
168+
]
169+
152170
default = [
153171
#"flecs_regenerate_binding_c",
154172
#"flecs_nightly_tests",
155-
"flecs_module",
173+
"flecs_base",
156174
"flecs_script",
157175
"flecs_snapshot",
158176
"flecs_stats",
159177
"flecs_metrics",
160178
"flecs_alerts",
161-
"flecs_system",
162-
"flecs_pipeline",
163-
"flecs_timer",
164179
"flecs_meta",
165180
"flecs_units",
166181
"flecs_json",
167182
"flecs_doc",
168183
"flecs_log",
169184
"flecs_app",
170-
"flecs_os_api_impl",
171185
"flecs_http",
172186
"flecs_rest",
187+
"flecs_query_rust_traits"
173188
]
174189

175190
######################

flecs_ecs/doc/flecs/book.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[book]
2+
name = "Flecs Rust"
3+
authors = ["Indradb"]
4+
description = "Documentation for the Rust bindings of Flecs ECS"
5+
language = "en"
6+
multilingual = false
7+
src = "src"
8+
title = "Flecs Rust"
9+
10+
[output.html]
11+
git-repository-url = "https://github.com/Indra-db/Flecs-Rust"
12+
edit-url-template = "https://github.com/Indra-db/Flecs-Rust/edit/main/flecs_ecs/doc/{path}"
13+
additional-css = ["theme/tabs.css", "theme/mdbook-admonish.css", "theme/mdbook-admonish.css"]
14+
additional-js = ["theme/tabs.js"]
15+
default-theme = "ayu"
16+
17+
[output.html.playground]
18+
runnable = false
19+
20+
[preprocessor.tabs]
21+
22+
[preprocessor.admonish]
23+
command = "mdbook-admonish"
24+
assets_version = "3.0.3" # do not edit: managed by `mdbook-admonish install`

flecs_ecs/doc/flecs/src/SUMMARY.md

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)