Skip to main content

Module asset

Module asset 

Source
Expand description

Asset management for embedded images, fonts, and files.

This module provides types and utilities for managing assets embedded within Codex documents.

§Asset Types

  • Images: AVIF, WebP, PNG, JPEG, SVG formats with dimensions and alt text
  • Fonts: WOFF2, WOFF, TTF, OTF formats with font family metadata
  • Embeds: Arbitrary files with MIME type and description

§Asset Index

Each asset category has an index file (e.g., assets/images/index.json) that lists all assets with their metadata and hashes for verification.

§Example

use cdx_core::asset::{ImageAsset, ImageFormat};

let image = ImageAsset::new("logo", ImageFormat::Png)
    .with_dimensions(200, 100)
    .with_alt("Company logo");

Structs§

AssetAlias
An alias entry that references another asset.
AssetIndex
An asset index file structure.
EmbedAsset
An embedded file asset.
FontAsset
A font asset embedded in a Codex document.
ImageAsset
An image asset embedded in a Codex document.
ImageVariant
A resolution variant of an image for responsive display.

Enums§

AssetEntry
Generic asset entry that can represent any asset type.
FontFormat
Font format enumeration.
FontStyle
Font style.
FontWeight
Font weight values.
ImageFormat
Image format enumeration.

Traits§

Asset
Common trait for all asset types.

Functions§

verify_asset_hash
Verify an asset’s integrity by checking its hash.

Type Aliases§

EmbedIndex
Type alias for embed asset index.
FontIndex
Type alias for font asset index.
ImageIndex
Type alias for image asset index.