Skip to main content

AssetWriter

Trait AssetWriter 

Source
pub trait AssetWriter: Send + Sync {
    // Required method
    fn write_bytes(&self, rel_path: &Path, bytes: &[u8]) -> Result<()>;
}
Expand description

Sibling trait to AssetIo for editor-time writing of assets back to storage. Implemented only by crate::asset::FileLoader — release builds (PackLoader) are intentionally read-only, which is why AssetWriter lives separately rather than extending AssetIo.

Used by the editor’s ProjectVfs to persist scene saves and any other asset mutation through the same root path the FileLoader reads from.

Required Methods§

Source

fn write_bytes(&self, rel_path: &Path, bytes: &[u8]) -> Result<()>

Writes bytes to a path relative to the loader’s root. Creates intermediate directories as needed. The relative path is the same shape that AssetSource::Path(rel) records — IndexBuilder will see the new file on the next scan and assign it a stable UUID.

Implementors§