diff --git a/noodles-vcf/CHANGELOG.md b/noodles-vcf/CHANGELOG.md index 842b9c2c0..645fd4a3b 100644 --- a/noodles-vcf/CHANGELOG.md +++ b/noodles-vcf/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Unreleased + +### Added + + * vcf/header/record/value/map: Add mutable getter for other fields + (`Map::::other_fields_mut`). + ## 0.45.0 - 2023-11-02 ### Changed diff --git a/noodles-vcf/src/header/record/value/map.rs b/noodles-vcf/src/header/record/value/map.rs index 0a5f136e2..229909bb1 100644 --- a/noodles-vcf/src/header/record/value/map.rs +++ b/noodles-vcf/src/header/record/value/map.rs @@ -90,6 +90,25 @@ where pub fn other_fields(&self) -> &OtherFields { &self.other_fields } + + /// Returns a mutable reference to the nonstandard fields in the map. + /// + /// # Examples + /// + /// ``` + /// use noodles_vcf::header::record::value::{map::Filter, Map}; + /// + /// let tag = match "noodles".parse() { + /// Ok(tag) => tag, + /// Err(_) => unreachable!(), + /// }; + /// + /// let mut map = Map::::pass(); + /// map.other_fields_mut().insert(tag, String::from("vcf")); + /// ``` + pub fn other_fields_mut(&mut self) -> &mut OtherFields { + &mut self.other_fields + } } impl Default for Map