Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Switchy
Feature-gated re-exports of platform-specific implementations for cross-platform compatibility.
Overview
The Switchy package provides:
- Conditional Re-exports: Feature-gated access to platform-specific modules
- Unified Interface: Single import point for cross-platform functionality
- Module Organization: Structured access to async, database, filesystem, and network modules
- Feature Flexibility: Enable only the modules you need
Features
Available Modules
async: Async runtime utilities (exposed underswitchy::unsync, viaswitchy_async)async-macros: Async macro utilities (viaswitchy_async_macros)database: Database abstraction layer (viaswitchy_database)database-connection: Database connection management (viaswitchy_database_connection)fs: Filesystem operations (viaswitchy_fs)mdns: mDNS service discovery (viaswitchy_mdns)random: Random number generation (viaswitchy_random)tcp: TCP networking (viaswitchy_tcp)telemetry: Telemetry and monitoring (viaswitchy_telemetry)time: Time utilities (viaswitchy_time)upnp: UPnP device discovery (viaswitchy_upnp)uuid: UUID generation utilities (viaswitchy_uuid)web-server: Web server abstractions (viaswitchy_web_server)web-server-core: Core web server types and traits (viaswitchy_web_server_core)http: HTTP client/server (viaswitchy_httpandswitchy_http_models)
Module Structure
- Individual Features: Each module is behind its own feature flag
- Nested Modules: HTTP module can expose both client and models based on enabled features
- Clean Imports: Simple import paths for all functionality
Installation
Add this to your Cargo.toml:
[]
= { = "../switchy", = ["async", "tcp", "http"] }
# Or enable all features
= { = "../switchy", = [
"async",
"async-macros",
"database",
"database-connection",
"fs",
"mdns",
"random",
"tcp",
"telemetry",
"time",
"upnp",
"uuid",
"web-server",
"web-server-core",
"http",
"http-models"
] }
Usage
Async Utilities
// Enable with features = ["async", "async-time"]
use unsync;
// Primary async entry points are under switchy::unsync
use ;
// Runtime-agnostic sleep (Tokio or simulator backend based on features)
sleep.await;
When async-macros is enabled, these main async macros are also available:
switchy::unsync::select!switchy::unsync::join!switchy::unsync::try_join!#[switchy::unsync::main]
Database Operations
// Enable with features = ["database", "database-connection"]
use ;
// Use database functionality
Filesystem Operations
// Enable with features = ["fs"]
use fs;
// Use filesystem operations
Network Operations
// Enable with features = ["tcp", "mdns", "upnp"]
use ;
// Use networking functionality
HTTP Client/Server
// Enable with features = ["http", "http-models"]
use http;
use models;
// Use HTTP functionality
Telemetry and Monitoring
// Enable with features = ["telemetry"]
use telemetry;
// Use telemetry functionality
Time Utilities
// Enable with features = ["time"]
use time;
// Use time utilities
Random Number Generation
// Enable with features = ["random"]
use random;
// Use random number generation
Feature Flags
Top-Level Features
all(default): Enable all base module featuressimulator: Enable simulator mode across all modulesfail-on-warnings: Treat warnings as errors
Base Module Features
async: Enable async runtime utilitiesasync-macros: Enable async macro utilitiesdatabase: Enable database abstraction layerdatabase-connection: Enable database connection managementfs: Enable filesystem operationsmdns: Enable mDNS service discoveryrandom: Enable random number generationtcp: Enable TCP networkingtelemetry: Enable telemetry and monitoringtime: Enable time utilitiesupnp: Enable UPnP device discoveryuuid: Enable UUID generation utilitiesweb-server: Enable web server abstractionsweb-server-core: Enable core web server typeshttp: Enable HTTP client/serverhttp-models: Enable HTTP model types
Convenience "All" Features
Each module has an all-* feature that enables all sub-features for that module:
all-async: All async featuresall-async-macros: All async macro featuresall-database: All database featuresall-database-connection: All database connection featuresall-fs: All filesystem featuresall-http: All HTTP featuresall-http-models: All HTTP model featuresall-mdns: All mDNS featuresall-random: All random featuresall-tcp: All TCP featuresall-telemetry: All telemetry featuresall-time: All time featuresall-upnp: All UPnP featuresall-uuid: All UUID featuresall-web-server: All web server features
Sub-Features
Each module has additional sub-features for fine-grained control:
Async: async-fs, async-io, async-net, async-process, async-rt-multi-thread, async-sync, async-time, async-tokio, async-util
Database: database-api, database-mysql, database-mysql-sqlx, database-postgres, database-postgres-raw, database-postgres-sqlx, database-schema, database-simulator, database-sqlite, database-sqlite-rusqlite, database-sqlite-sqlx, database-sqlx, database-tls, database-turso
Database Connection: database-connection-creds, database-connection-mysql, database-connection-mysql-sqlx, database-connection-postgres, database-connection-postgres-native-tls, database-connection-postgres-openssl, database-connection-postgres-raw, database-connection-postgres-sqlx, database-connection-simulator, database-connection-sqlite, database-connection-sqlite-rusqlite, database-connection-sqlite-sqlx, database-connection-sqlx, database-connection-tls, database-connection-turso
Filesystem: fs-async, fs-simulator, fs-simulator-real-fs, fs-std, fs-sync, fs-tokio
HTTP: http-brotli, http-deflate, http-gzip, http-json, http-reqwest, http-serde, http-simulator, http-stream, http-zstd
HTTP Models: http-models-actix, http-models-reqwest, http-models-serde
mDNS: mdns-simulator
Random: random-rand, random-simulator
TCP: tcp-simulator, tcp-tokio
Telemetry: telemetry-actix, telemetry-simulator
Time: time-simulator, time-std
UPnP: upnp-api, upnp-openapi, upnp-simulator
UUID: uuid-serde, uuid-simulator, uuid-uuid
Web Server: web-server-actix, web-server-compress, web-server-core, web-server-cors, web-server-htmx, web-server-openapi, web-server-openapi-all, web-server-openapi-rapidoc, web-server-openapi-redoc, web-server-openapi-scalar, web-server-openapi-swagger-ui, web-server-serde, web-server-simulator, web-server-static-files, web-server-tls
Dependencies
This package re-exports functionality from:
switchy_async- Async runtime utilitiesswitchy_async_macros- Async macro utilitiesswitchy_database- Database abstractionswitchy_database_connection- Database connectionsswitchy_fs- Filesystem operationsswitchy_mdns- mDNS service discoveryswitchy_random- Random number generationswitchy_tcp- TCP networkingswitchy_telemetry- Telemetry and monitoringswitchy_time- Time utilitiesswitchy_upnp- UPnP device discoveryswitchy_uuid- UUID generation utilitiesswitchy_web_server- Web server abstractionsswitchy_web_server_core- Core web server typesswitchy_http- HTTP client/serverswitchy_http_models- HTTP model types
Use Cases
- Cross-platform Applications: Single interface for platform-specific functionality
- Feature-gated Libraries: Enable only needed functionality to reduce binary size
- Modular Architecture: Clean separation of concerns across different domains
- Testing: Easy mocking and testing with feature flags