mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-11 04:52:13 +00:00
craft-doc: keep ICC helper separate from metadata additions
This commit is contained in:
1 parent
ee2d912f24
commit
21a7644df4
1 file changed
+8
-8
@@ -207,14 +207,6 @@ pub(crate) fn outline(bytes: &[u8], budget: &mut Budget) -> Result<Outline, Erro
|
||||
})
|
||||
}
|
||||
|
||||
/// The archive and the manifest's document read as `D`, checked as [`outline`] reads it.
|
||||
#[cfg(feature = "pcraft-pixels")]
|
||||
pub(crate) fn document<'a, D: DeserializeOwned>(bytes: &'a [u8], budget: &mut Budget) -> Result<(Zip<'a>, D), Error> {
|
||||
let (zip, json) = manifest(bytes, budget)?;
|
||||
let document = read::<D>(&json, budget)?.document;
|
||||
Ok((zip, document))
|
||||
}
|
||||
|
||||
/// The archive and a document head, with structural items checked before deserialization.
|
||||
#[cfg(feature = "pcraft-pixels")]
|
||||
pub(crate) fn document_with_items<'a, D: DeserializeOwned>(bytes: &'a [u8], budget: &mut Budget) -> Result<(Zip<'a>, D), Error> {
|
||||
@@ -222,3 +214,11 @@ pub(crate) fn document_with_items<'a, D: DeserializeOwned>(bytes: &'a [u8], budg
|
||||
let max_items = usize::try_from(budget.limits.max_items).unwrap_or(usize::MAX);
|
||||
Ok((zip, read_with_items::<D>(&json, budget, max_items)?.document))
|
||||
}
|
||||
|
||||
/// The archive and the manifest's document read as `D`, checked as [`outline`] reads it.
|
||||
#[cfg(feature = "pcraft-pixels")]
|
||||
pub(crate) fn document<'a, D: DeserializeOwned>(bytes: &'a [u8], budget: &mut Budget) -> Result<(Zip<'a>, D), Error> {
|
||||
let (zip, json) = manifest(bytes, budget)?;
|
||||
let document = read::<D>(&json, budget)?.document;
|
||||
Ok((zip, document))
|
||||
}
|
||||
Reference in new issue
Block a user