pub struct ComposeDocumentBuilder { /* private fields */ }Expand description
Builder for one new deterministic Compose document.
Implementations§
Source§impl ComposeDocumentBuilder
impl ComposeDocumentBuilder
Sourcepub fn set_name(
&mut self,
name: impl Into<String>,
) -> Result<(), GenerationError>
pub fn set_name( &mut self, name: impl Into<String>, ) -> Result<(), GenerationError>
Sets the optional top-level Compose project name exactly once.
§Errors
Rejects empty/NUL-bearing names and duplicate configuration.
Sourcepub fn add_service(
&mut self,
service: GeneratedService,
) -> Result<(), GenerationError>
pub fn add_service( &mut self, service: GeneratedService, ) -> Result<(), GenerationError>
Adds one uniquely named service in output order.
§Errors
Returns GenerationError::DuplicateName for a duplicate service name.
Sourcepub fn add_network(
&mut self,
network: GeneratedResource,
) -> Result<(), GenerationError>
pub fn add_network( &mut self, network: GeneratedResource, ) -> Result<(), GenerationError>
Adds one uniquely named top-level network in output order.
§Errors
Returns GenerationError::DuplicateName for a duplicate network name.
Sourcepub fn add_volume(
&mut self,
volume: GeneratedResource,
) -> Result<(), GenerationError>
pub fn add_volume( &mut self, volume: GeneratedResource, ) -> Result<(), GenerationError>
Adds one uniquely named top-level volume in output order.
§Errors
Returns GenerationError::DuplicateName for a duplicate volume name.
Sourcepub fn build(
self,
source_id: SourceId,
) -> Result<GeneratedComposeDocument, GenerationError>
pub fn build( self, source_id: SourceId, ) -> Result<GeneratedComposeDocument, GenerationError>
Generates YAML and parses it back through ComposeLens’s syntax and typed-model boundaries.
§Errors
Returns GenerationError::MissingService for an empty project or
GenerationError::InternalInvariant if ComposeLens cannot parse its own output.
Trait Implementations§
Source§impl Clone for ComposeDocumentBuilder
impl Clone for ComposeDocumentBuilder
Source§fn clone(&self) -> ComposeDocumentBuilder
fn clone(&self) -> ComposeDocumentBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more