mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-28 09:09:25 +01:00
Preserve main's decoder, atomic-save, material-payload, and USDC limits. Bound material reads by the remaining payload budget and trim retained buffers. Replace quadratic image-name searches with map lookups, and cache validated linked-material maps before synchronization so they are not decoded twice. Add import/undo/redo and payload-boundary regressions, extract ImageIdentity, remove the unchecked scratch example, and complete scoped cleanup. Correct the integrated style guide's product name. Validated 546 release tests, Clippy, layering, wasm, formatting, and focused allocation and lifetime probes.
20 lines
459 B
Rust
20 lines
459 B
Rust
use std::sync::{Arc, Weak};
|
|
|
|
use crate::store::ImageRes;
|
|
|
|
/// Keeps an image's allocation identity stable without retaining pixels after resource removal.
|
|
#[derive(Debug)]
|
|
pub(crate) struct ImageIdentity(Weak<ImageRes>);
|
|
|
|
impl ImageIdentity {
|
|
pub(crate) fn new(image: &Arc<ImageRes>) -> Self {
|
|
Self(Arc::downgrade(image))
|
|
}
|
|
}
|
|
|
|
impl PartialEq for ImageIdentity {
|
|
fn eq(&self, other: &Self) -> bool {
|
|
self.0.ptr_eq(&other.0)
|
|
}
|
|
}
|