lib3mf-async 0.4.0

Non-blocking async 3MF parsing with tokio - high-throughput manufacturing data processing
Documentation

lib3mf-async

Crates.io docs.rs License

Non-blocking async 3MF parsing with tokio - high-throughput manufacturing data processing.

When to Use This Crate

Use lib3mf-async when you need:

  • Non-blocking I/O for web servers or async applications
  • High-throughput processing of multiple 3MF files
  • Integration with tokio-based async ecosystems

Quick Start

[dependencies]
lib3mf-async = "0.4"
tokio = { version = "1", features = ["full"] }
use lib3mf_async::loader::load_model_async;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let model = load_model_async("model.3mf").await?;
    println!("Loaded model with {} objects", model.resources.iter_objects().count());
    Ok(())
}

Features

  • Async ZIP archive reading using async-zip
  • Non-blocking I/O operations
  • Compatible with Tokio runtime
  • Seamless integration with lib3mf-core types

Performance

Async I/O allows processing multiple 3MF files concurrently without blocking:

use lib3mf_async::loader::load_model_async;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let files = vec!["model1.3mf", "model2.3mf", "model3.3mf"];
    let handles: Vec<_> = files.into_iter().map(|path| {
        tokio::spawn(async move {
            load_model_async(path).await
        })
    }).collect();

    let results = futures::future::join_all(handles).await;
    for result in results {
        match result {
            Ok(Ok(model)) => println!("Loaded: {} objects", model.resources.iter_objects().count()),
            _ => eprintln!("Failed to load model"),
        }
    }
    Ok(())
}

Related

License

BSD-2-Clause