diff options
author | Jonas Platte <jplatte+git@posteo.de> | 2023-10-16 23:55:22 +0200 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2023-11-20 23:51:53 -0500 |
commit | 824778c009165d5b56f97aad1b824a2bca039c08 (patch) | |
tree | 1750c8c23ec233f049c54321944330babdc42fb4 /crates | |
parent | 922bad2b92a564ac442368e9e2522f11d61f593f (diff) |
globset: add GlobSet::builder
This avoids needing to import and call GlobSetBuilder::new explicitly.
Closes #2635
Diffstat (limited to 'crates')
-rw-r--r-- | crates/globset/src/lib.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/globset/src/lib.rs b/crates/globset/src/lib.rs index fb1f27c0..b1fc696a 100644 --- a/crates/globset/src/lib.rs +++ b/crates/globset/src/lib.rs @@ -304,6 +304,14 @@ pub struct GlobSet { } impl GlobSet { + /// Create a new [`GlobSetBuilder`]. A `GlobSetBuilder` can be used to add + /// new patterns. Once all patterns have been added, `build` should be + /// called to produce a `GlobSet`, which can then be used for matching. + #[inline] + pub fn builder() -> GlobSetBuilder { + GlobSetBuilder::new() + } + /// Create an empty `GlobSet`. An empty set matches nothing. #[inline] pub fn empty() -> GlobSet { @@ -485,9 +493,9 @@ pub struct GlobSetBuilder { } impl GlobSetBuilder { - /// Create a new GlobSetBuilder. A GlobSetBuilder can be used to add new + /// Create a new `GlobSetBuilder`. A `GlobSetBuilder` can be used to add new /// patterns. Once all patterns have been added, `build` should be called - /// to produce a `GlobSet`, which can then be used for matching. + /// to produce a [`GlobSet`], which can then be used for matching. pub fn new() -> GlobSetBuilder { GlobSetBuilder { pats: vec![] } } |