pub fn rename_section<'lookup>(
        &mut self,
        section_name: &'lookup str,
        subsection_name: impl Into<Option<&'lookup str>>,
        new_section_name: impl Into<SectionHeaderName<'event>>,
        new_subsection_name: impl Into<Option<Cow<'event, str>>>,
    ) -> Result<(), GitConfigError<'lookup>> {
        let id = self.get_section_ids_by_name_and_subname(section_name, subsection_name.into())?;
        let id = id
            .last()
            .expect("list of sections were empty, which violates invariant");
        let header = self
            .section_headers
            .get_mut(id)
            .expect("sections does not have section id from section ids");
        header.name = new_section_name.into();
        header.subsection_name = new_subsection_name.into();

        Ok(())
    }
/// Renames a section, modifying the last matching section.
///
/// # Errors
///
/// Returns an error if the lookup doesn't exist
Renames a section, modifying the last matching section.
Renames a section modifying the last matching section .
pub fn rename_section<'lookup>(
        &mut self,
        section_name: &'lookup str,
        subsection_name: impl Into<Option<&'lookup str>>,
        new_section_name: impl Into<SectionHeaderName<'event>>,
        new_subsection_name: impl Into<Option<Cow<'event, str>>>,
    ) -> Result<(), GitConfigError<'lookup>> {
        let id = self.get_section_ids_by_name_and_subname(section_name, subsection_name.into())?;
        let id = id
            .last()
            .expect("list of sections were empty, which violates invariant");
        let header = self
            .section_headers
            .get_mut(id)
            .expect("sections does not have section id from section ids");
        header.name = new_section_name.into();
        header.subsection_name = new_subsection_name.into();
        Ok(())
    }
pub fn rename_section < ' lookup > ( & mut self , section_name : & ' lookup str , subsection_name : impl Into < Option < & ' lookup str > > , new_section_name : impl Into < SectionHeaderName < ' event > > , new_subsection_name : impl Into < Option < Cow < ' event , str > > > , ) -> Result < ( ) , GitConfigError < ' lookup > > { let id = self . get_section_ids_by_name_and_subname ( section_name , subsection_name . into ( ) ) ? ; let id = id . last ( ) . expect ( " " ) ; let header = self . section_headers . get_mut ( id ) . expect ( " " ) ; header . name = new_section_name . into ( ) ; header . subsection_name = new_subsection_name . into ( ) ; Ok ( ( ) ) }
Renames a section, modifying the last matching section.
Renames a section modifying the last matching section .
&mut self
section_name
&'lookup str
subsection_name
impl Into<Option<&'lookup str>>
new_section_name
impl Into<SectionHeaderName<'event>>
new_subsection_name
impl Into<Option<Cow<'event, str>>>
errors
Returns an error if the lookup doesn't exist
Returns an error if the lookup doesn ' t exist