Tutorial package and platform entry point
examples/tutorials/src/lib.rs · 20 source lines
Read the chapters in source order. Select a numbered source line to expand its explanation; the line numbers and code match this snapshot exactly.
cargo check -p ravet-examples --no-default-features --lockedChapters
Separate portable modules from the native UI
delay and synth are always public modules. ui is compiled only on macOS when live-ui is enabled. This keeps offline processors available without the native window/device dependency graph.
1//! Example processors and, on macOS, a live window built from RAVET components.
Source note: Example processors and, on macOS, a live window built from RAVET components.
Link to line 12//!
Source note:
Link to line 23//! The portable subtractive synth is distinct from the existing Sine CLAP export.
Source note: The portable subtractive synth is distinct from the existing Sine CLAP export.
Link to line 34//! UI and device ownership remain outside its audio processing implementation.
Source note: UI and device ownership remain outside its audio processing implementation.
Link to line 45pub mod delay;
Bring these module/type names into scope for “Separate portable modules from the native UI”; the surrounding chapter explains their responsibilities.
Link to line 56pub mod synth;
Bring these module/type names into scope for “Separate portable modules from the native UI”; the surrounding chapter explains their responsibilities.
Link to line 67#[cfg(all(target_os = "macos", feature = "live-ui"))]
Apply this Rust attribute to the following item. cfg selects which target/feature/test build contains it; derive generates the named trait implementations.
Link to line 78pub mod ui;
Bring these module/type names into scope for “Separate portable modules from the native UI”; the surrounding chapter explains their responsibilities.
Link to line 89
Blank line separating the surrounding statements.
Link to line 9Launch with an explicit platform boundary
launch returns a boxed-error Result. On macOS with live-ui it delegates to ui::run. The complementary cfg branch returns an explanatory error; it does not silently replace the native UI with an unrelated backend.
10/// Open an interactive example on macOS, or explain the current native UI limit.
Source note: Open an interactive example on macOS, or explain the current native UI limit.
Link to line 1011pub fn launch(mode: &str) -> Result<(), Box<dyn std::error::Error>> {
Define launch. launch returns a boxed-error Result. On macOS with live-ui it delegates to ui::run. The complementary cfg branch returns an explanatory error; it does not silently replace the native UI with an unrelated backend.
Link to line 1112 #[cfg(all(target_os = "macos", feature = "live-ui"))]
Apply this Rust attribute to the following item. cfg selects which target/feature/test build contains it; derive generates the named trait implementations.
Link to line 1213 {
Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.
Link to line 1314 ui::run(mode)
Define or initialize ui with the displayed type/value. Its ownership and use are described in “Launch with an explicit platform boundary”.
Link to line 1415 }
Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.
Link to line 1516 #[cfg(not(all(target_os = "macos", feature = "live-ui")))]
Apply this Rust attribute to the following item. cfg selects which target/feature/test build contains it; derive generates the named trait implementations.
Link to line 1617 {
Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.
Link to line 1718 Err(format!("{mode}: native UI currently requires macOS and the live-ui feature; offline fixtures remain available").into())
Construct the success/error variant selected by the surrounding match or function return. The enclosed value becomes its payload.
Link to line 1819 }
Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.
Link to line 1920}
Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.
Link to line 20