pub struct PackageDocument {
pub minified: Option<String>,
pub packages: BTreeMap<String, Vec<Map<String, Value>>>,
}Expand description
A /p2/<vendor>/<name>.json document: a map (usually single-entry,
keyed by vendor/name) of version lists. When
minified is Some("composer/2.0"), the version
lists are sparse diffs (see crate::minify); otherwise each entry
stands alone.
Fields§
§minified: Option<String>The minified-format marker. Some("composer/2.0") means the
packages version lists are diffs; any other value (or None)
means they stand alone.
packages: BTreeMap<String, Vec<Map<String, Value>>>vendor/name → version list (Packagist orders newest-first).
Each version is a raw object so the minify/expand pass can run
before any typed deserialization.
Implementations§
Source§impl PackageDocument
impl PackageDocument
Sourcepub fn flat(packages: BTreeMap<String, Vec<Map<String, Value>>>) -> Self
pub fn flat(packages: BTreeMap<String, Vec<Map<String, Value>>>) -> Self
Build a non-minified document: each version stands alone.
Sourcepub fn minified(packages: BTreeMap<String, Vec<Map<String, Value>>>) -> Self
pub fn minified(packages: BTreeMap<String, Vec<Map<String, Value>>>) -> Self
Build a minified composer/2.0 document from fully-materialized
version lists, applying minify_versions to each package.
Sourcepub fn expand(self) -> BTreeMap<String, Vec<Map<String, Value>>>
pub fn expand(self) -> BTreeMap<String, Vec<Map<String, Value>>>
Expand into fully-materialized version objects, honoring the
minified marker. A document whose marker is
anything other than composer/2.0 is returned as-is (each entry
already stands alone) — defensive against a future format bump.
Trait Implementations§
Source§impl Clone for PackageDocument
impl Clone for PackageDocument
Source§fn clone(&self) -> PackageDocument
fn clone(&self) -> PackageDocument
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more