moosicbox_app_native_image 0.3.0

MoosicBox App Image package
docs.rs failed to build moosicbox_app_native_image-0.3.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: moosicbox_app_native_image-0.1.1

MoosicBox Native App Image Assets

Embedded image asset management for MoosicBox native applications.

Overview

The MoosicBox Native App Image package provides:

  • Asset Embedding: Compile-time image asset embedding
  • Efficient Access: Fast asset retrieval and conversion to Arc
  • Memory Management: Arc for shared asset access
  • Rust Embed Integration: Static asset bundling at build time

Features

Asset Management

  • Compile-Time Embedding: Assets embedded during compilation
  • Convenient Conversion: Helper function to convert embedded assets to Arc
  • Shared References: Arc for memory-efficient sharing
  • Path Prefixing: Organized asset path structure

Performance

  • Static Assets: No runtime file I/O for embedded assets
  • Memory Efficient: Shared references reduce memory usage
  • Fast Access: Direct memory access to embedded data

Installation

Add this to your Cargo.toml:

[dependencies]
moosicbox_app_native_image = { path = "../app/native/image" }

Usage

Asset Access

use moosicbox_app_native_image::{Asset, get_asset_arc_bytes};
use rust_embed::RustEmbed;

// Get an embedded asset
let asset = Asset::get("/public/logo.png").unwrap();

// Convert to Arc<Bytes> for efficient sharing
let data = get_asset_arc_bytes(asset);

// Use the asset data
serve_image_response(data).await;

Available Assets

Assets are embedded from the ../public/ directory with the /public/ prefix.

Build Configuration

Asset Directory

Assets are embedded from: $CARGO_MANIFEST_DIR/../public/

Prefix

All assets are accessible with the /public/ prefix.

Dependencies

  • Rust Embed: Static asset embedding
  • Bytes: Efficient byte buffer management
  • Standard Library: Core functionality

Integration

This package is designed for:

  • Native Desktop Apps: Bundled image assets
  • Tauri Applications: Static asset serving
  • Embedded GUIs: Image asset management
  • Self-Contained Apps: No external file dependencies