From 4b270733c3271293c7a91f4b4696f8c5cd8eb06e Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 18 May 2024 19:57:30 +0200 Subject: [PATCH] refactor(src): Rename `TrinitryInvokation` to just `Trinitry` for simplicity --- src/lib.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f3c009f..db36b68 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -81,12 +81,12 @@ use pest::error::Error; mod parsing; -pub struct TrinitryInvokation { +pub struct Trinitry { command: String, arguments: Vec, } -impl TrinitryInvokation { +impl Trinitry { pub fn new(input: &str) -> Result::Err> { input.parse() } @@ -100,7 +100,7 @@ impl TrinitryInvokation { } } -impl FromStr for TrinitryInvokation { +impl FromStr for Trinitry { type Err = Error; fn from_str(s: &str) -> Result { @@ -109,7 +109,7 @@ impl FromStr for TrinitryInvokation { } } -impl From> for TrinitryInvokation { +impl From> for Trinitry { fn from(parsed: TrinitryParser) -> Self { let command = { let command: Vec<_> = parsed.0.clone().find_tagged("command").collect(); @@ -161,7 +161,7 @@ impl From> for TrinitryInvokation { } } -impl Display for TrinitryInvokation { +impl Display for Trinitry { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if self.arguments.is_empty() { f.write_str(&self.command) @@ -179,12 +179,12 @@ mod tests; #[cfg(test)] mod test { - use crate::TrinitryInvokation; + use crate::Trinitry; #[test] fn parse_cmd() { let string = "quit"; - let p = TrinitryInvokation::new(string).unwrap_or_else(|e| { + let p = Trinitry::new(string).unwrap_or_else(|e| { panic!("{}", e); }); assert_eq!(&p.command, "quit"); @@ -194,7 +194,7 @@ mod test { #[test] fn parse_arg_clean() { let string = r##"lua print("Hi")"##; - let p = TrinitryInvokation::new(string).unwrap_or_else(|e| { + let p = Trinitry::new(string).unwrap_or_else(|e| { panic!("{}", e); }); assert_eq!(&p.command, "lua"); @@ -204,7 +204,7 @@ mod test { #[test] fn parse_arg_quote() { let string = r##"write "some 'file' name""##; - let p = TrinitryInvokation::new(string).unwrap_or_else(|e| { + let p = Trinitry::new(string).unwrap_or_else(|e| { panic!("{}", e); }); assert_eq!(&p.command, "write"); @@ -214,7 +214,7 @@ mod test { #[test] fn parse_arg_single_quote() { let string = r##"write 'some "file" name'"##; - let p = TrinitryInvokation::new(string).unwrap_or_else(|e| { + let p = Trinitry::new(string).unwrap_or_else(|e| { panic!("{}", e); }); assert_eq!(&p.command, "write"); @@ -224,7 +224,7 @@ mod test { #[test] fn parse_arg_multi() { let string = r##"write 'some "file" name' "other name" last"##; - let p = TrinitryInvokation::new(string).unwrap_or_else(|e| { + let p = Trinitry::new(string).unwrap_or_else(|e| { panic!("{}", e); });