mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2025-12-12 16:35:56 +00:00
refactor: builder pattern minor renaming
This commit is contained in:
parent
5f3f4e1072
commit
b1954ab54d
2 changed files with 6 additions and 10 deletions
|
|
@ -32,11 +32,7 @@ impl ShellComposition {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn register_shell_window(
|
pub fn with_window(mut self, component_name: impl Into<String>, config: WindowConfig) -> Self {
|
||||||
mut self,
|
|
||||||
component_name: impl Into<String>,
|
|
||||||
config: WindowConfig,
|
|
||||||
) -> Self {
|
|
||||||
self.shell_windows.push(ShellWindowDefinition {
|
self.shell_windows.push(ShellWindowDefinition {
|
||||||
component_name: component_name.into(),
|
component_name: component_name.into(),
|
||||||
config,
|
config,
|
||||||
|
|
@ -44,13 +40,13 @@ impl ShellComposition {
|
||||||
self
|
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.shell_windows.extend(definitions);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn auto_discover(mut self, component_names: Vec<impl Into<String>>) -> Self {
|
pub fn with_default_config_for(mut self, components: Vec<impl Into<String>>) -> Self {
|
||||||
self.auto_discover_components = component_names.into_iter().map(Into::into).collect();
|
self.auto_discover_components = components.into_iter().map(Into::into).collect();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,7 +64,7 @@ impl ShellComposition {
|
||||||
|
|
||||||
if self.shell_windows.is_empty() {
|
if self.shell_windows.is_empty() {
|
||||||
return Err(Error::Domain(DomainError::Configuration {
|
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(),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
//! // Create shell with typed WindowConfig
|
//! // Create shell with typed WindowConfig
|
||||||
//! let shell = ShellComposition::new()
|
//! let shell = ShellComposition::new()
|
||||||
//! .with_compilation_result(compilation_result)
|
//! .with_compilation_result(compilation_result)
|
||||||
//! .register_shell_window("TopBar", WindowConfig::default())
|
//! .with_window("TopBar", WindowConfig::default())
|
||||||
//! .build()?;
|
//! .build()?;
|
||||||
//!
|
//!
|
||||||
//! shell.run()?;
|
//! shell.run()?;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue