Skip to content

Commit f99d129

Browse files
author
bors-servo
authored
Auto merge of rust-lang#157 - fitzgen:doc-regex-set-mod, r=emilio
Document the `regex_set` module r? @emilio
2 parents 3618f55 + 735fb48 commit f99d129

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ mod clangll;
5656
doc_mod!(clang);
5757
doc_mod!(ir);
5858
doc_mod!(parse);
59-
mod regex_set;
59+
doc_mod!(regex_set);
6060

6161
mod codegen {
6262
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));

src/regex_set.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
//! A type that represents the union of a set of regular expressions.
2+
13
use std::borrow::Borrow;
24
use regex::Regex;
35

46
// Yeah, I'm aware this is sorta crappy, should be cheaper to compile a regex
57
// ORing all the patterns, I guess...
8+
9+
/// A dynamic set of regular expressions.
610
#[derive(Debug)]
711
pub struct RegexSet {
812
items: Vec<Regex>
913
}
1014

1115
impl RegexSet {
16+
/// Is this set empty?
1217
pub fn is_empty(&self) -> bool {
1318
self.items.is_empty()
1419
}
1520

21+
/// Extend this set with every regex in the iterator.
1622
pub fn extend<I>(&mut self, iter: I)
1723
where I: IntoIterator<Item=String>
1824
{
@@ -21,6 +27,7 @@ impl RegexSet {
2127
}
2228
}
2329

30+
/// Insert a new regex into this set.
2431
pub fn insert<S>(&mut self, string: &S)
2532
where S: Borrow<str>
2633
{
@@ -35,6 +42,7 @@ impl RegexSet {
3542
}
3643
}
3744

45+
/// Does the given `string` match any of the regexes in this set?
3846
pub fn matches<S>(&self, string: &S) -> bool
3947
where S: Borrow<str>
4048
{

0 commit comments

Comments
 (0)