Skip to content

Commit

Permalink
vcf/header/record/value/map: Add mutable getter for other fields
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Nov 4, 2023
1 parent b9e4d6f commit 2a9576a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions noodles-vcf/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased

### Added

* vcf/header/record/value/map: Add mutable getter for other fields
(`Map::<I>::other_fields_mut`).

## 0.45.0 - 2023-11-02

### Changed
Expand Down
19 changes: 19 additions & 0 deletions noodles-vcf/src/header/record/value/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ where
pub fn other_fields(&self) -> &OtherFields<I::StandardTag> {
&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::<Filter>::pass();
/// map.other_fields_mut().insert(tag, String::from("vcf"));
/// ```
pub fn other_fields_mut(&mut self) -> &mut OtherFields<I::StandardTag> {
&mut self.other_fields
}
}

impl<I> Default for Map<I>
Expand Down

0 comments on commit 2a9576a

Please sign in to comment.