ModelResource

Trait ModelResource 

Source
pub trait ModelResource<Cx: ?Sized>: Send + Sync {
    // Required methods
    fn label(&self) -> &'static str;
    fn release(&mut self, cx: &Cx) -> Result<()>;
}
Expand description

2026-09-25: State that owns device memory and must be released in a defined order.

Cx is whatever releasing needs; for GPU state that is the backend (dyn GpuBackend). Making it a type parameter keeps metrale-core free of a dependency on the backend crate while still handing each resource the thing that owns its memory.

Required Methods§

Source

fn label(&self) -> &'static str

2026-09-25: Human name, used to attribute a failure in Teardown::release_all’s error.

Source

fn release(&mut self, cx: &Cx) -> Result<()>

2026-09-25: Release everything this owns. Must be idempotent.

Implementors§