pub trait AssetWriter: Send + Sync {
// Required method
fn write_bytes(&self, rel_path: &Path, bytes: &[u8]) -> Result<(), Error>;
}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§
Sourcefn write_bytes(&self, rel_path: &Path, bytes: &[u8]) -> Result<(), Error>
fn write_bytes(&self, rel_path: &Path, bytes: &[u8]) -> Result<(), Error>
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.