mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-14 22:27:03 +05:30
refactor: rename Substitutor.matcher_type
to matcher
This commit is contained in:
parent
6c4b5f617b
commit
80e33e97e6
3 changed files with 4 additions and 4 deletions
|
@ -14,7 +14,7 @@ pub struct Substitutor<'config> {
|
|||
#[serde(default)]
|
||||
pub name: &'config str,
|
||||
#[serde(borrow, alias = "matcher")]
|
||||
pub matcher_type: MatcherType<'config>,
|
||||
pub matcher: MatcherType<'config>,
|
||||
#[serde(borrow)]
|
||||
pub action: Action<'config>,
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ fn loop_clipboard<'a>(config: Replacements<'a>) {
|
|||
let mut clipboard_contents = get_clipboard_contents(&mut clipboard);
|
||||
while let Ok(contents) = clipboard_contents.as_deref() {
|
||||
if let Some(subst) = config.substitutors.iter().find(|subst| {
|
||||
return match &subst.matcher_type {
|
||||
return match &subst.matcher {
|
||||
MatcherType::Single(matcher) => matcher.check_match(contents),
|
||||
MatcherType::Multiple(matchers) => {
|
||||
matchers.iter().all(|matcher| matcher.check_match(contents))
|
||||
|
|
|
@ -52,7 +52,7 @@ fn parse_with_multiple_matchers() {
|
|||
assert_eq!(1, config.substitutors.len());
|
||||
let subst = &config.substitutors[0];
|
||||
assert_eq!("Example", subst.name);
|
||||
assert!(matches!(subst.matcher_type, MatcherType::Multiple(_)));
|
||||
assert!(matches!(subst.matcher, MatcherType::Multiple(_)));
|
||||
assert!(matches!(subst.action, Action::Prefix { .. }));
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,6 @@ fn parse_with_single_matcher() {
|
|||
assert_eq!(1, config.substitutors.len());
|
||||
let subst = &config.substitutors[0];
|
||||
assert_eq!("Example", subst.name);
|
||||
assert!(matches!(subst.matcher_type, MatcherType::Single(_)));
|
||||
assert!(matches!(subst.matcher, MatcherType::Single(_)));
|
||||
assert!(matches!(subst.action, Action::Prefix { .. }));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue