diff --git a/crates/composition/src/builder.rs b/crates/composition/src/builder.rs index b65cdc4..30a0ea2 100644 --- a/crates/composition/src/builder.rs +++ b/crates/composition/src/builder.rs @@ -36,15 +36,15 @@ impl LayerShika { } } - pub fn from_file( + pub fn from_file(path: impl AsRef) -> Result> { + Self::from_file_with_component(path, "Main") + } + + pub fn from_file_with_component( path: impl AsRef, - component_name: Option<&str>, + component_name: impl AsRef, ) -> Result> { - Self::from_file_with_compiler( - path, - &mut Compiler::default(), - component_name.unwrap_or("Main"), - ) + Self::from_file_with_compiler(path, &mut Compiler::default(), component_name.as_ref()) } pub fn from_file_with_compiler( @@ -85,15 +85,15 @@ impl LayerShika { }) } - pub fn from_source( + pub fn from_source(source: impl AsRef) -> Result> { + Self::from_source_with_component(source, "Main") + } + + pub fn from_source_with_component( source: impl AsRef, - component_name: Option<&str>, + component_name: impl AsRef, ) -> Result> { - Self::from_source_with_compiler( - source, - &mut Compiler::default(), - component_name.unwrap_or("Main"), - ) + Self::from_source_with_compiler(source, &mut Compiler::default(), component_name.as_ref()) } pub fn from_source_with_compiler(