From f76ed75f5b1eac2cee50e4e5f0b07cdcecb3fcef Mon Sep 17 00:00:00 2001 From: graelo Date: Sat, 20 Mar 2021 07:01:23 +0100 Subject: [PATCH] refactor: RawMatch -> textbuf/raw_match.rs --- src/textbuf/mod.rs | 1 + src/textbuf/model.rs | 10 +--------- src/textbuf/raw_match.rs | 8 ++++++++ 3 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 src/textbuf/raw_match.rs diff --git a/src/textbuf/mod.rs b/src/textbuf/mod.rs index 4dfc15e..646ee07 100644 --- a/src/textbuf/mod.rs +++ b/src/textbuf/mod.rs @@ -1,3 +1,4 @@ mod model; +mod raw_match; pub use model::{Match, Model}; diff --git a/src/textbuf/model.rs b/src/textbuf/model.rs index 8338370..f0cb2f7 100644 --- a/src/textbuf/model.rs +++ b/src/textbuf/model.rs @@ -3,6 +3,7 @@ use std::collections; use regex::Regex; use sequence_trie::SequenceTrie; +use super::raw_match::RawMatch; use crate::alphabets::Alphabet; use crate::regexes::{NamedPattern, EXCLUDE_PATTERNS, PATTERNS}; @@ -238,15 +239,6 @@ pub struct Match<'a> { pub hint: String, } -/// Internal surrogate for `Match`, before a Hint has been associated. -#[derive(Debug)] -struct RawMatch<'a> { - pub x: i32, - pub y: i32, - pub pattern: &'a str, - pub text: &'a str, -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/textbuf/raw_match.rs b/src/textbuf/raw_match.rs new file mode 100644 index 0000000..7da45ce --- /dev/null +++ b/src/textbuf/raw_match.rs @@ -0,0 +1,8 @@ +/// Internal surrogate for `Match`, before a Hint has been associated. +#[derive(Debug)] +pub(super) struct RawMatch<'a> { + pub x: i32, + pub y: i32, + pub pattern: &'a str, + pub text: &'a str, +}