pub struct Collection { /* private fields */ }Expand description
Shared immutable collection bytes. Cloning shares payload allocations.
use powerio::{Collection, CollectionLimits, CollectionSelection, ParseOptions};
let collection = Collection::from_directory("study", CollectionLimits::default())?;
for candidate in collection.inspect()? {
println!("{:?}", candidate);
}
let selection = CollectionSelection::file("masters/weekday.dss").format("dss");
let result = collection.parse(&selection, &ParseOptions::default())?;
println!("observed dependencies: {:?}", result.dependencies);Implementations§
Source§impl Collection
impl Collection
pub fn origin(&self) -> CollectionOrigin
pub fn selection_origin( &self, selection: &CollectionSelection, ) -> SelectionOrigin
Sourcepub fn read_manifest(&self, bytes: &[u8]) -> Result<CollectionManifest>
pub fn read_manifest(&self, bytes: &[u8]) -> Result<CollectionManifest>
Read bounded metadata only. Nested paths are validated syntactically; opening them and validating selected members waits for explicit use.
Sourcepub fn parse_manifest_case(
&self,
manifest: &CollectionManifest,
id: &str,
) -> Result<CollectionResult>
pub fn parse_manifest_case( &self, manifest: &CollectionManifest, id: &str, ) -> Result<CollectionResult>
Execute one catalog case explicitly; siblings remain independent.
Sourcepub fn source_bundle(
&self,
selection: &CollectionSelection,
scope: SourceBundleScope,
) -> Result<SourceBundle>
pub fn source_bundle( &self, selection: &CollectionSelection, scope: SourceBundleScope, ) -> Result<SourceBundle>
Export an explicitly requested source scope. Bytes are shared, and the collection need not stay alive after the bundle has been returned.
Source§impl Collection
impl Collection
Sourcepub fn open_nested(&self, member: &str) -> Result<Self>
pub fn open_nested(&self, member: &str) -> Result<Self>
Open exactly one named child ZIP. Its namespace is independent: sources cannot resolve against a parent or sibling. All descendants and clones share the monotonic entry and expansion counters of admitted content, so reopening a child counts again, while each open’s own input and decompression work is bounded on its own.
Sourcepub fn cancellation(&self) -> Cancellation
pub fn cancellation(&self) -> Cancellation
Cancel subsequent discovery, child acquisition, and selected parses. ZIP reads check the signal between chunks. Electrical parsers retain their own bounded work rules; synchronous WASM may be terminated by its worker.
Source§impl Collection
impl Collection
Sourcepub fn from_files(
name: impl Into<String>,
files: impl IntoIterator<Item = (ArtifactPath, Arc<[u8]>)>,
limits: CollectionLimits,
) -> Result<Self>
pub fn from_files( name: impl Into<String>, files: impl IntoIterator<Item = (ArtifactPath, Arc<[u8]>)>, limits: CollectionLimits, ) -> Result<Self>
Admit a named memory tree. Does not execute a parser or read the host.
Sourcepub fn from_zip(
name: impl Into<String>,
bytes: Arc<[u8]>,
limits: CollectionLimits,
) -> Result<Self>
pub fn from_zip( name: impl Into<String>, bytes: Arc<[u8]>, limits: CollectionLimits, ) -> Result<Self>
Fully verify a bounded ZIP once. Original container and member bytes are retained separately. Nested containers remain ordinary opaque members.
Sourcepub fn from_zip_cancellable(
name: impl Into<String>,
bytes: Arc<[u8]>,
limits: CollectionLimits,
cancel: Cancellation,
) -> Result<Self>
pub fn from_zip_cancellable( name: impl Into<String>, bytes: Arc<[u8]>, limits: CollectionLimits, cancel: Cancellation, ) -> Result<Self>
Acquire a ZIP with a caller-owned cancellation signal.
Sourcepub fn from_directory(
path: impl AsRef<Path>,
limits: CollectionLimits,
) -> Result<Self>
pub fn from_directory( path: impl AsRef<Path>, limits: CollectionLimits, ) -> Result<Self>
Acquire a folder through core’s confined source reader. Once acquired, selections cannot fall back to disk or see later filesystem changes.
pub fn name(&self) -> &str
pub fn entries(&self) -> &[CollectionEntry]
pub fn original_zip(&self) -> Option<Arc<[u8]>>
Sourcepub fn inspect(&self) -> Result<Vec<CollectionCandidate>>
pub fn inspect(&self) -> Result<Vec<CollectionCandidate>>
Bounded suggestions, without electrical parsing or filename precedence. Every inventory file remains explicitly selectable even if omitted here.
Sourcepub fn source(&self, selection: &CollectionSelection) -> Result<Source>
pub fn source(&self, selection: &CollectionSelection) -> Result<Source>
Build one confined source. Each call starts fresh observations; retained companions share bytes. Generic ZIP traversal requires another operation.
Sourcepub fn parse(
&self,
selection: &CollectionSelection,
options: &ParseOptions,
) -> Result<CollectionResult>
pub fn parse( &self, selection: &CollectionSelection, options: &ParseOptions, ) -> Result<CollectionResult>
Parse or deserialize one explicit selection. Call independently for each selected case; one error never prevents processing another selection.