fn mut_or_insert_element(
        &mut self,
        feature: &gherkin::Feature,
        rule: Option<&gherkin::Rule>,
        scenario: &gherkin::Scenario,
        ty: &'static str,
    ) -> &mut Element {
        let f_pos = self
            .features
            .iter()
            .position(|f| f == feature)
            .unwrap_or_else(|| {
                self.features.push(Feature::new(feature));
                self.features.len() - 1
            });
        let f = self
            .features
            .get_mut(f_pos)
            .unwrap_or_else(|| unreachable!());

        let el_pos = f
            .elements
            .iter()
            .position(|el| {
                el.name
                    == format!(
                        "{}{}",
                        rule.map(|r| format!("{} ", r.name))
                            .unwrap_or_default(),
                        scenario.name,
                    )
                    && el.line == scenario.position.line
                    && el.r#type == ty
            })
            .unwrap_or_else(|| {
                f.elements.push(Element::new(feature, rule, scenario, ty));
                f.elements.len() - 1
            });
        f.elements.get_mut(el_pos).unwrap_or_else(|| unreachable!())
    }
/// Inserts the given `scenario`, if not present, and then returns a mutable
/// reference to the contained value.
Inserts the given `scenario`, if not present, and then returns a mutable
reference to the contained value.
Inserts the given ` scenario ` if not present and then returns a mutable reference to the contained value .
fn mut_or_insert_element(
        &mut self,
        feature: &gherkin::Feature,
        rule: Option<&gherkin::Rule>,
        scenario: &gherkin::Scenario,
        ty: &'static str,
    ) -> &mut Element {
        let f_pos = self
            .features
            .iter()
            .position(|f| f == feature)
            .unwrap_or_else(|| {
                self.features.push(Feature::new(feature));
                self.features.len() - 1
            });
        let f = self
            .features
            .get_mut(f_pos)
            .unwrap_or_else(|| unreachable!());
        let el_pos = f
            .elements
            .iter()
            .position(|el| {
                el.name
                    == format!(
                        "{}{}",
                        rule.map(|r| format!("{} ", r.name))
                            .unwrap_or_default(),
                        scenario.name,
                    )
                    && el.line == scenario.position.line
                    && el.r#type == ty
            })
            .unwrap_or_else(|| {
                f.elements.push(Element::new(feature, rule, scenario, ty));
                f.elements.len() - 1
            });
        f.elements.get_mut(el_pos).unwrap_or_else(|| unreachable!())
    }
fn mut_or_insert_element ( & mut self , feature : & gherkin :: Feature , rule : Option < & gherkin :: Rule > , scenario : & gherkin :: Scenario , ty : & ' static str , ) -> & mut Element { let f_pos = self . features . iter ( ) . position ( | f | f == feature ) . unwrap_or_else ( | | { self . features . push ( Feature :: new ( feature ) ) ; self . features . len ( ) - 1 } ) ; let f = self . features . get_mut ( f_pos ) . unwrap_or_else ( | | unreachable ! ( ) ) ; let el_pos = f . elements . iter ( ) . position ( | el | { el . name == format ! ( " " rule map ( r format ( " " r name ) ) unwrap_or_default ( ) scenario name ) && el . line == scenario . position . line && el . r#type == ty } ) . unwrap_or_else ( | | { f . elements . push ( Element :: new ( feature , rule , scenario , ty ) ) ; f . elements . len ( ) - 1 } ) ; f . elements . get_mut ( el_pos ) . unwrap_or_else ( | | unreachable ! ( ) ) }
Inserts the given `scenario`, if not present, and then returns a mutable
reference to the contained value.
Inserts the given ` scenario ` if not present and then returns a mutable reference to the contained value .
&mut self
feature
&gherkin::Feature
rule
Option<&gherkin::Rule>
scenario
&gherkin::Scenario
ty
&'static str
&mut self
feature
&gherkin::Feature
rule
Option<&gherkin::Rule>
scenario
&gherkin::Scenario
ty
&'static str