• Home
  • Raw
  • Download

Lines Matching full: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;
128 /// let re = Regex::new(r"python\d$").unwrap();
138 /// use regex::Regex;
140 /// which_re(Regex::new("^cargo-.*").unwrap()).unwrap()
143 #[cfg(feature = "regex")]
144 pub fn which_re(regex: impl Borrow<Regex>) -> Result<impl Iterator<Item = path::PathBuf>> { in which_re()
145 which_re_in(regex, env::var_os("PATH")) in which_re()
161 /// Only available when feature `regex` is enabled.
165 /// * `regex` - A regular expression to match binaries with
172 /// use regex::Regex;
176 /// let re = Regex::new(r"python\d$").unwrap();
182 #[cfg(feature = "regex")]
184 regex: impl Borrow<Regex>, in which_re_in() argument
194 finder.find_re(regex, paths, binary_checker) in which_re_in()
242 #[cfg(feature = "regex")]
243 regex: Option<Regex>, field
252 #[cfg(feature = "regex")] in default()
253 regex: None, in default()
258 #[cfg(feature = "regex")]
259 type Regex = regex::Regex; typedef
261 #[cfg(not(feature = "regex"))]
262 type Regex = (); typedef
273 /// If regex was set previously, and you've just passed in `use_cwd: true`, this will panic.
275 #[cfg(feature = "regex")] in system_cwd()
276 if self.regex.is_some() && use_cwd { in system_cwd()
277 panic!("which can't use regex and cwd at the same time!") in system_cwd()
287 /// If regex was set previously, this will panic.
289 #[cfg(feature = "regex")] in custom_cwd()
290 if self.regex.is_some() { in custom_cwd()
291 panic!("which can't use regex and cwd at the same time!") in custom_cwd()
297 …/// Sets the path name regex to search for. You ***MUST*** call this, or [`Self::binary_name`] pri…
299 …/// When `Regex` is disabled this function takes the unit type as a stand in. The parameter will c…
300 /// `Regex` is enabled.
304 …/// If the `regex` feature wasn't turned on for this crate this will always panic. Additionally if…
306 /// are incompatible with `regex`.
308 pub fn regex(mut self, regex: Regex) -> Self { in regex() method
309 #[cfg(not(feature = "regex"))] in regex()
311 panic!("which's regex feature was not enabled in your Cargo.toml!") in regex()
313 #[cfg(feature = "regex")] in regex()
316 panic!("which can't use regex and cwd at the same time!") in regex()
319 panic!("which can't use `binary_name` and `regex` at the same time!"); in regex()
321 self.regex = Some(regex); in regex()
326 …/// Sets the path name to search for. You ***MUST*** call this, or [`Self::regex`] prior to search…
330 /// If a `regex` was set previously this will panic as this is not compatible with `regex`.
332 #[cfg(feature = "regex")] in binary_name()
333 if self.regex.is_some() { in binary_name()
334 panic!("which can't use `binary_name` and `regex` at the same time!"); in binary_name()
366 #[cfg(feature = "regex")] in all_results()
367 if let Some(regex) = self.regex { in all_results()
369 .find_re(regex, paths, binary_checker) in all_results()
382 "binary_name not set! You must set binary_name or regex before searching!", in all_results()