Add ErgConfig::inherit

and remove with_module_path
This commit is contained in:
Shunsuke Shibayama 2022-12-14 05:38:50 +09:00
parent 0e928c758f
commit b09fce8a86
2 changed files with 10 additions and 11 deletions

View file

@ -225,14 +225,6 @@ impl ErgConfig {
}
}
pub fn with_module_path(path: PathBuf) -> Self {
Self {
module: Box::leak(path.to_str().unwrap().to_string().into_boxed_str()),
input: Input::File(path),
..ErgConfig::default()
}
}
/// cloneのエイリアス(実際のcloneコストは低いので)
#[inline]
pub fn copy(&self) -> Self {
@ -247,6 +239,14 @@ impl ErgConfig {
}
}
pub fn inherit(&self, path: PathBuf) -> Self {
Self {
module: Box::leak(path.to_str().unwrap().to_string().into_boxed_str()),
input: Input::File(path),
..self.copy()
}
}
pub fn parse() -> Self {
let mut args = env::args();
args.next(); // "ergc"