Expand description
Core simulation harness APIs.
Re-exports all public types, traits, and functions from simvar_harness,
including run_simulation, Sim, SimBootstrap, and SimConfig.
Runtime abstraction layer for testing and simulation.
switchy provides runtime-agnostic interfaces for async operations, I/O, networking,
and other system interactions. It enables code to be written once and run against
different backends (e.g., Tokio, simulator) by switching feature flags.
§Feature Flags
This crate uses feature flags extensively to control which backends are enabled:
async- Core async runtime abstractions viaswitchy_asyncasync-tokio- Use Tokio as the async runtimesimulator- Use simulated runtime for deterministic testingasync-macros- Enable async macros likeselect!,join!,try_join!database- Database abstraction layerfs- Filesystem abstraction layerhttp- HTTP client abstraction layertcp- TCP networking abstraction layertime- Time and timing abstractionsall- Enable all features (default)
§Examples
use switchy::unsync::time::{sleep, Duration};
// This code works with both Tokio and simulator runtimes
sleep(Duration::from_secs(1)).await;Modules§
- database
- Database Abstraction Layer for Switchy Ecosystem
- database_
connection - Database connection initialization and credential management.
- fs
- Switchy filesystem abstraction layer with support for real and simulated filesystems.
- http
- HTTP client and model abstractions.
- mdns
- mDNS service registration and discovery for
MoosicBoxservers. - random
- Thread-safe random number generation with pluggable backends.
- tcp
- Generic TCP stream and listener abstractions for async Rust.
- telemetry
- OpenTelemetry-based telemetry and metrics collection for Switchy services.
- time
- Time utilities with support for both standard system time and simulated time.
- unsync
- Async runtime abstractions and utilities.
- unsync_
macros - Internal macro support for async operations.
- upnp
- UPnP/DLNA device discovery and control library.
- web_
server - A flexible, backend-agnostic HTTP web server framework for Rust.