Lines Matching refs:regex
23 #[cfg(feature = "regex")]
113 /// Only available when feature `regex` is enabled.
117 /// * `regex` - A regular expression to match binaries with
124 /// use regex::Regex;
138 /// use regex::Regex;
143 #[cfg(feature = "regex")]
144 pub fn which_re(regex: impl Borrow<Regex>) -> Result<impl Iterator<Item = path::PathBuf>> {
145 which_re_in(regex, env::var_os("PATH"))
161 /// Only available when feature `regex` is enabled.
165 /// * `regex` - A regular expression to match binaries with
172 /// use regex::Regex;
182 #[cfg(feature = "regex")]
184 regex: impl Borrow<Regex>,
194 finder.find_re(regex, paths, binary_checker)
242 #[cfg(feature = "regex")]
243 regex: Option<Regex>,
252 #[cfg(feature = "regex")]
253 regex: None,
258 #[cfg(feature = "regex")]
259 type Regex = regex::Regex;
261 #[cfg(not(feature = "regex"))]
273 /// If regex was set previously, and you've just passed in `use_cwd: true`, this will panic.
275 #[cfg(feature = "regex")]
276 if self.regex.is_some() && use_cwd {
277 panic!("which can't use regex and cwd at the same time!")
287 /// If regex was set previously, this will panic.
289 #[cfg(feature = "regex")]
290 if self.regex.is_some() {
291 panic!("which can't use regex and cwd at the same time!")
297 /// Sets the path name regex to search for. You ***MUST*** call this, or [`Self::binary_name`] prior to searching.
304 /// If the `regex` feature wasn't turned on for this crate this will always panic. Additionally if a
306 /// are incompatible with `regex`.
308 pub fn regex(mut self, regex: Regex) -> Self {
309 #[cfg(not(feature = "regex"))]
311 panic!("which's regex feature was not enabled in your Cargo.toml!")
313 #[cfg(feature = "regex")]
316 panic!("which can't use regex and cwd at the same time!")
319 panic!("which can't use `binary_name` and `regex` at the same time!");
321 self.regex = Some(regex);
326 /// Sets the path name to search for. You ***MUST*** call this, or [`Self::regex`] prior to searching.
330 /// If a `regex` was set previously this will panic as this is not compatible with `regex`.
332 #[cfg(feature = "regex")]
333 if self.regex.is_some() {
334 panic!("which can't use `binary_name` and `regex` at the same time!");
366 #[cfg(feature = "regex")]
367 if let Some(regex) = self.regex {
369 .find_re(regex, paths, binary_checker)
382 "binary_name not set! You must set binary_name or regex before searching!",