d84914ef1e5a
image_identity.rs
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)
}
}
No file is open. Choose one in the tree, or press Ctrl+O (⌘O on a Mac) to find one by name.
Syntax highlighting could not load. The unmodified read-only text remains available above.