-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerslambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework
Description
Overview
Reorganize the existing examples from crates/lambda-rs/examples/ into a
dedicated demos/ directory at the repository root. Demo crates will be
included in the main workspace members but excluded from default-members,
so they are not built by default but remain accessible via -p flag. This
structure enables better feature flag management per demo category, cleaner
build configurations, and a more scalable approach for showcasing engine
capabilities.
Current State
Examples currently reside in crates/lambda-rs/examples/ as individual .rs
files:
crates/lambda-rs/examples/
├── audio_sine_wave.rs
├── immediates.rs
├── indexed_multi_vertex_buffers.rs
├── instanced_quads.rs
├── minimal.rs
├── offscreen_post.rs
├── play_slash_sound.rs
├── reflective_room.rs
├── sound_buffer_load.rs
├── textured_cube.rs
├── textured_quad.rs
├── triangle.rs
├── triangles.rs
└── uniform_buffer_triangle.rs
This flat structure has several limitations:
- All examples share the same Cargo feature configuration
- No separation between audio, rendering, and other demo categories
- Difficult to enable feature flags selectively per demo type
- Examples must be run via
cargo run --example <name> -p lambda-rs
Scope
Goals:
- Create a
demos/directory at the repository root - Organize demos into domain-specific crates (e.g.,
demos/audio/,
demos/render/,demos/minimal/) - Configure appropriate feature flags per demo crate
- Add demo crates to workspace
membersbut exclude fromdefault-members - Maintain backward compatibility by keeping minimal examples in
crates/lambda-rs/examples/for documentation purposes - Provide clear README documentation for running demos
Non-Goals:
- Creating new demos (existing examples will be migrated)
- Modifying the core
lambda-rsorlambda-rs-platformAPIs - Automated demo testing infrastructure (can be addressed separately)
Proposed API
demos/
├── README.md # Documentation for running demos
├── audio/
│ ├── Cargo.toml # [features] audio-specific flags
│ └── src/
│ └── bin/
│ ├── sine_wave.rs
│ ├── play_sound.rs
│ └── sound_buffer.rs
├── render/
│ ├── Cargo.toml # [features] render-validation, etc.
│ └── src/
│ └── bin/
│ ├── triangle.rs
│ ├── triangles.rs
│ ├── immediates.rs
│ ├── indexed_multi_vertex_buffers.rs
│ ├── instanced_quads.rs
│ ├── textured_quad.rs
│ ├── textured_cube.rs
│ ├── uniform_buffer_triangle.rs
│ ├── offscreen_post.rs
│ └── reflective_room.rs
└── minimal/
├── Cargo.toml # Minimal dependencies
└── src/
└── bin/
└── minimal.rs
Example demos/render/Cargo.toml:
[package]
name = "lambda-demos-render"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
lambda-rs = { path = "../../crates/lambda-rs" }
[features]
default = []
validation = ["lambda-rs/render-validation"]
validation-strict = ["lambda-rs/render-validation-strict"]
[[bin]]
name = "triangle"
path = "src/bin/triangle.rs"
[[bin]]
name = "textured_quad"
path = "src/bin/textured_quad.rs"
# ... additional binariesRoot Cargo.toml changes:
[workspace]
resolver = "2"
members = [
"crates/lambda-rs",
"crates/lambda-rs-args",
"crates/lambda-rs-logging",
"crates/lambda-rs-platform",
"tools/obj_loader",
"tools/lambda_audio",
# Demo crates included in workspace but not built by default
"demos/audio",
"demos/render",
"demos/minimal",
]
default-members = [
"crates/lambda-rs",
"crates/lambda-rs-args",
"crates/lambda-rs-logging",
"crates/lambda-rs-platform",
"tools/obj_loader",
]Running demos:
# Run a render demo with default features
cargo run -p lambda-demos-render --bin triangle
# Run with validation enabled
cargo run -p lambda-demos-render --bin triangle --features validation
# Run an audio demo
cargo run -p lambda-demos-audio --bin sine_waveAcceptance Criteria
Acceptance Criteria
-
demos/directory created at repository root -
demos/audio/crate with migrated audio examples -
demos/render/crate with migrated rendering examples -
demos/minimal/crate with basic window example - Each demo crate has appropriate feature flags configured
- Root
Cargo.tomlupdated: demo crates added tomembers, excluded from
default-members -
cargo builddoes not build demos by default -
cargo build -p lambda-demos-renderbuilds only the render demos -
demos/README.mddocuments how to build and run demos - Existing
crates/lambda-rs/examples/simplified to minimal reference
examples for rustdoc - All migrated demos compile and run successfully
Affected Crates
lambda-rs
Notes
- Demo crates should use
publish = falseto prevent accidental publishing - Excluding demos from
default-memberskeepscargo build --workspacefast
while still allowingcargo build -p <demo-crate>access - Consider adding a
demos/shared/crate if common utilities emerge - Feature flags in demo crates should mirror high-level
lambda-rsfeatures - This structure aligns with patterns used in
wgpuandbevyrepositories - Future demos (physics, UI, etc.) can follow the same pattern
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerslambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework