pondrs 0.3.0

A pipeline execution library
Documentation
//! Embedded frontend assets served by the viz server.

use rust_embed::RustEmbed;

/// All files from `viz-frontend/dist/` are embedded at compile time.
#[derive(RustEmbed)]
#[folder = "viz-frontend/dist/"]
pub struct FrontendAssets;

/// Return the MIME type for a file path based on its extension.
pub fn mime_for_path(path: &str) -> &'static str {
    match path.rsplit('.').next() {
        Some("html") => "text/html; charset=utf-8",
        Some("js") | Some("mjs") => "application/javascript; charset=utf-8",
        Some("css") => "text/css; charset=utf-8",
        Some("json") => "application/json",
        Some("svg") => "image/svg+xml",
        Some("png") => "image/png",
        Some("jpg") | Some("jpeg") => "image/jpeg",
        Some("ico") => "image/x-icon",
        Some("woff2") => "font/woff2",
        Some("woff") => "font/woff",
        Some("ttf") => "font/ttf",
        Some("map") => "application/json",
        _ => "application/octet-stream",
    }
}