DES-10 T7: AssetData::linked_under turns hash-checked embedded bytes into a link under their key

(cherry picked from commit e5599145c5cf80903e41ba74b505b2409bfd1249)
This commit is contained in:
aiongg committed 2026-11-14 06:24:45 +00:00
1 parent 3f1cbb4d23
commit a53bf7203c
1 file changed
+7
+7
View File
@@ -132,6 +132,13 @@ impl AssetData {
AssetData { key: SourceKey::fresh(), repr: Repr::Linked(Arc::new(Linked { source, trusted: Mutex::new(None) })) }
}
/// The linked file `source` names, under `key`: embedded bytes found identical to the file
/// (hash-checked by the caller) become a link without decoding them again. As with
/// [`AssetData::embedded_under`], other bytes under one key would draw stale pixels.
pub fn linked_under(key: SourceKey, source: LinkedSource) -> Self {
AssetData { key, repr: Repr::Linked(Arc::new(Linked { source, trusted: Mutex::new(None) })) }
}
/// This value pointing at `source` (the file moved, the document was saved elsewhere, the
/// fingerprint was brought up to date). It keeps the key when both name the same bytes
/// (same size and content hash), so nothing decoded is decoded again.