mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
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:
1 parent
3f1cbb4d23
commit
a53bf7203c
1 file changed
+7
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user