refactor: builder pattern minor renaming

This commit is contained in:
drendog 2025-12-03 18:41:28 +01:00
parent 5f3f4e1072
commit b1954ab54d
Signed by: dwenya
GPG key ID: 8DD77074645332D0
2 changed files with 6 additions and 10 deletions

View file

@ -32,11 +32,7 @@ impl ShellComposition {
self
}
pub fn register_shell_window(
mut self,
component_name: impl Into<String>,
config: WindowConfig,
) -> Self {
pub fn with_window(mut self, component_name: impl Into<String>, config: WindowConfig) -> Self {
self.shell_windows.push(ShellWindowDefinition {
component_name: component_name.into(),
config,
@ -44,13 +40,13 @@ impl ShellComposition {
self
}
pub fn register_shell_windows(mut self, definitions: Vec<ShellWindowDefinition>) -> Self {
pub fn with_windows(mut self, definitions: Vec<ShellWindowDefinition>) -> Self {
self.shell_windows.extend(definitions);
self
}
pub fn auto_discover(mut self, component_names: Vec<impl Into<String>>) -> Self {
self.auto_discover_components = component_names.into_iter().map(Into::into).collect();
pub fn with_default_config_for(mut self, components: Vec<impl Into<String>>) -> Self {
self.auto_discover_components = components.into_iter().map(Into::into).collect();
self
}
@ -68,7 +64,7 @@ impl ShellComposition {
if self.shell_windows.is_empty() {
return Err(Error::Domain(DomainError::Configuration {
message: "No shell windows registered. Use register_shell_window(), register_shell_windows(), or auto_discover()".to_string(),
message: "No shell windows registered. Use add_window(), add_windows(), or with_default_config_for()".to_string(),
}));
}

View file

@ -44,7 +44,7 @@
//! // Create shell with typed WindowConfig
//! let shell = ShellComposition::new()
//! .with_compilation_result(compilation_result)
//! .register_shell_window("TopBar", WindowConfig::default())
//! .with_window("TopBar", WindowConfig::default())
//! .build()?;
//!
//! shell.run()?;