Trait Asset

Source
pub trait Asset:
    Send
    + Sync
    + 'static { }
Expand description

A marker trait for types that can be managed by the asset system.

This trait’s primary purpose is to categorize a type, making it eligible for use within the engine’s asset infrastructure (e.g., in a Handle<T>).

The supertraits enforce critical safety guarantees:

  • Send + Sync: The asset type can be safely shared and sent between threads. This is essential for background loading.
  • 'static: The asset type does not contain any non-static references, ensuring it can be stored for the lifetime of the application.

§Examples

use khora_core::asset::Asset;

// A simple struct representing a texture.
struct Texture {
    // ... fields
}

// By implementing Asset, `Texture` can now be used by the asset system.
impl Asset for Texture {}

Implementors§