rmpca 0.1.1

Enterprise-grade route optimization engine — Chinese Postman Problem solver with Eulerian circuit detection, Lean 4 FFI boundary, and property-based testing
Documentation
//! `serve-tiles` subcommand — local HTTP server for `PMTiles`
//!
//! Serves vector tiles from a local .pmtiles file via HTTP.
//! Default endpoint: <http://localhost:8080/{z}/{x}/{y}.pbf>
//!
//! NOTE: Requires `axum`, `pmtiles`, and `tower-http` crates to be vendored.
//! Until then, this command returns an error indicating missing dependencies.

use anyhow::Result;
use clap::Args;
use std::path::PathBuf;

#[derive(Debug, Args)]
pub struct ServeTilesArgs {
    /// Path to the .pmtiles file
    pub input: PathBuf,

    /// Port to listen on
    #[arg(long, default_value = "8080")]
    pub port: u16,

    /// Address to listen on
    #[arg(long, default_value = "127.0.0.1")]
    pub addr: String,
}

/// Serve vector tiles from a local `.pmtiles` file.
///
/// # Errors
/// Returns an error if the required dependencies (`axum`, `pmtiles`, `tower-http`)
/// are not available.
pub fn run(args: &ServeTilesArgs) -> Result<()> {
    anyhow::bail!(
        "serve-tiles requires axum, pmtiles, and tower-http crates. \
         Vendor them and enable the 'serve' feature to use this command.\n\
         Input: {}, Address: {}:{}",
        args.input.display(),
        args.addr,
        args.port
    )
}