pub struct ComposeSource { /* private fields */ }Expand description
A merged Compose project and the caller-owned context needed to import it safely.
Implementations§
Source§impl ComposeSource
impl ComposeSource
Sourcepub fn new(
project: MergedProject,
fallback_application_name: Identifier,
) -> Result<Self, ModelError>
pub fn new( project: MergedProject, fallback_application_name: Identifier, ) -> Result<Self, ModelError>
Creates a source without guessing profiles or source filenames from ambient state.
Every Compose source initially receives the stable neutral identity
compose-source-<numeric-id>. Call Self::with_source_id to replace it with a caller-owned
path, URI, or other display identity. The project’s explicit top-level name wins when
present; the fallback is used when Compose project naming was supplied externally or
omitted.
§Errors
Returns ModelError if a generated fallback source identity violates the neutral-model
invariant. This cannot occur for the current compose-source-<u32> spelling, but keeping
construction fallible avoids a hidden panic if that policy changes.
Sourcepub fn with_source_id(self, compose: ComposeSourceId, neutral: SourceId) -> Self
pub fn with_source_id(self, compose: ComposeSourceId, neutral: SourceId) -> Self
Assigns a caller-owned neutral identity to one Compose source document.
Unknown Compose source IDs are retained in the map but cannot contribute provenance unless they also occur in the merged project.
Sourcepub fn with_profile_selection(self, selection: ProfileSelection) -> Self
pub fn with_profile_selection(self, selection: ProfileSelection) -> Self
Attaches the explicit selection produced by ComposeLens project processing.
Sourcepub const fn project(&self) -> &MergedProject
pub const fn project(&self) -> &MergedProject
Returns the merged native project.
Sourcepub const fn fallback_application_name(&self) -> &Identifier
pub const fn fallback_application_name(&self) -> &Identifier
Returns the caller-selected fallback application name.
Sourcepub fn source_id(&self, compose: ComposeSourceId) -> Option<&SourceId>
pub fn source_id(&self, compose: ComposeSourceId) -> Option<&SourceId>
Resolves a Compose source identity into its neutral-model identity.
Sourcepub const fn profile_selection(&self) -> Option<&ProfileSelection>
pub const fn profile_selection(&self) -> Option<&ProfileSelection>
Returns the explicit profile selection, when one was supplied.
Trait Implementations§
Source§impl Clone for ComposeSource
impl Clone for ComposeSource
Source§fn clone(&self) -> ComposeSource
fn clone(&self) -> ComposeSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more