ruprizzle-cli 1.6.0

Command-line interface for the ruprizzle ORM
Documentation
//! Static assets embedded inside the binary via `rust_embed`.

use axum::http::{StatusCode, header};
use axum::response::{IntoResponse, Response};
use rust_embed::RustEmbed;

#[derive(RustEmbed)]
#[folder = "assets/"]
pub struct StudioAssets;

/// Serves static assets (CSS, JS, SVG) with appropriate content-type headers.
pub async fn serve_asset(path: &str) -> Response {
    match StudioAssets::get(path) {
        Some(content) => {
            let mime = mime_guess::from_path(path).first_or_octet_stream();
            (
                StatusCode::OK,
                [(header::CONTENT_TYPE, mime.as_ref())],
                content.data,
            )
                .into_response()
        }
        None => (StatusCode::NOT_FOUND, "Asset not found").into_response(),
    }
}