Installation
Requirements
- Rust ≥ 1.89 (edition 2024)
- A Unix-like OS (Linux, macOS) or Windows
Add to Your Project
Add mosaik to your Cargo.toml:
[dependencies]
mosaik = "0.2"
Mosaik pulls in its core dependencies automatically, including:
tokio— async runtime (full features)iroh— QUIC-based P2P networkingserde— serialization frameworkfutures—StreamandSinktraits
Common Additional Dependencies
Most mosaik applications will also want:
[dependencies]
tokio = { version = "1", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
futures = "0.3"
anyhow = "1"
tokio— you need the tokio runtime to run mosaikserdewithderive— for#[derive(Serialize, Deserialize)]on your data typesfutures— forStreamExt/SinkExttraits on consumers and producers
Verify Installation
Create a minimal test to verify everything links correctly:
use mosaik::{Network, NetworkId};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let network = Network::new("test-network".into()).await?;
println!("Node online: {}", network.local().id());
Ok(())
}
cargo run
If you see a node ID printed, mosaik is installed and working.
Feature Flags
Mosaik currently does not define any optional feature flags. All functionality is included by default.