Use StringMatchCandidate::new to construct candidates more conveniently
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
1e96fc98e7
commit
bd2527e691
4 changed files with 25 additions and 19 deletions
|
@ -98,6 +98,16 @@ impl<'a> MatchCandidate for PathMatchCandidate<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl StringMatchCandidate {
|
||||
pub fn new(id: usize, string: String) -> Self {
|
||||
Self {
|
||||
id,
|
||||
char_bag: CharBag::from(string.as_str()),
|
||||
string,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> MatchCandidate for &'a StringMatchCandidate {
|
||||
fn has_chars(&self, bag: CharBag) -> bool {
|
||||
self.char_bag.is_superset(bag)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue