pub struct KWIndex<'a> { /* private fields */ }Implementations§
Source§impl<'a> KWIndex<'a>
impl<'a> KWIndex<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/example.rs (line 5)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("Hey world!");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}More examples
examples/example2.rs (line 5)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("The total number of confirmed Wuhan coronavirus cases in mainland China stands at 17,205, the country's National Health Commission said Sunday, That figure is up 2,829 from the previous day. The death toll globally is 362. All but one of those deaths have occurred in China (mainland).");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}Sourcepub fn extend_from_text(self, target: &'a str) -> Self
pub fn extend_from_text(self, target: &'a str) -> Self
Examples found in repository?
examples/example.rs (line 8)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("Hey world!");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}More examples
examples/example2.rs (line 8)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("The total number of confirmed Wuhan coronavirus cases in mainland China stands at 17,205, the country's National Health Commission said Sunday, That figure is up 2,829 from the previous day. The death toll globally is 362. All but one of those deaths have occurred in China (mainland).");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}Sourcepub fn count_matches(&self, keyword: &str) -> usize
pub fn count_matches(&self, keyword: &str) -> usize
Examples found in repository?
examples/example.rs (line 13)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("Hey world!");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}More examples
examples/example2.rs (line 13)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("The total number of confirmed Wuhan coronavirus cases in mainland China stands at 17,205, the country's National Health Commission said Sunday, That figure is up 2,829 from the previous day. The death toll globally is 362. All but one of those deaths have occurred in China (mainland).");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Examples found in repository?
examples/example.rs (line 10)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("Hey world!");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}More examples
examples/example2.rs (line 10)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("The total number of confirmed Wuhan coronavirus cases in mainland China stands at 17,205, the country's National Health Commission said Sunday, That figure is up 2,829 from the previous day. The death toll globally is 362. All but one of those deaths have occurred in China (mainland).");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Examples found in repository?
examples/example.rs (line 6)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("Hey world!");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}More examples
examples/example2.rs (line 6)
4fn main() {
5 let mut index = KWIndex::new();
6 println!("is_empty(): {}\n", index.is_empty());
7
8 index = index.extend_from_text("The total number of confirmed Wuhan coronavirus cases in mainland China stands at 17,205, the country's National Health Commission said Sunday, That figure is up 2,829 from the previous day. The death toll globally is 362. All but one of those deaths have occurred in China (mainland).");
9 println!("\nis_empty(): {}", index.is_empty());
10 println!("len(): {}", index.len());
11
12 let check = "world";
13 println!("count_matches('{}'): {}", check, index.count_matches(check));
14 println!("\n{:?}", index);
15}Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for KWIndex<'a>
impl<'a> RefUnwindSafe for KWIndex<'a>
impl<'a> Send for KWIndex<'a>
impl<'a> Sync for KWIndex<'a>
impl<'a> Unpin for KWIndex<'a>
impl<'a> UnwindSafe for KWIndex<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more