// The function takes a pattern constructs a Regex and search the
// provided tip's component for a match. If match is found return Tip
The function takes a pattern constructs a Regex and search the
provided tip's component for a match. If match is found return Tip
The function takes a pattern constructs a Regex and search the provided tip ' s component for a match . If match is found return Tip
pub fn search<'a, 'b>(
    pattern: &'a str,
    tip: &'b crate::tip::Tip,
    component: &Component) -> Option<&'b crate::tip::Tip> {
    // Construct regex
    let regex = match regex::Regex::new(pattern) {
        Ok(regex) => regex,
        Err(error) => {
            panic!("Unable to construct Regex with pattern {}\n{}",
                   pattern, error)
        },
    };
    // Find matches if any, and return result
    match find(&regex, tip, &component) {
        Some(hit) => Some(hit),
        None      => None,
    }
}
pub fn search < ' a , ' b > ( pattern : & ' a str , tip : & ' b crate :: tip :: Tip , component : & Component ) -> Option < & ' b crate :: tip :: Tip > { // Construct regex let regex = match regex :: Regex :: new ( pattern ) { Ok ( regex ) => regex , Err ( error ) => { panic ! ( " \n " pattern error ) } , } ; // Find matches if any, and return result match find ( & regex , tip , & component ) { Some ( hit ) => Some ( hit ) , None => None , } }
The function takes a pattern constructs a Regex and search the
provided tip's component for a match.
The function takes a pattern constructs a Regex and search the provided tip ' s component for a match .
pattern
&'a str
tip
&'b crate::tip::Tip
component
&Component