Skip to content

Commit

Permalink
bed/feature/record_buf: Add mutable getters
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Aug 7, 2024
1 parent 22bccf0 commit 97d4b8a
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions noodles-bed/src/feature/record_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,30 @@ impl RecordBuf<3> {
self.standard_fields.reference_sequence_name.as_ref()
}

/// Returns a mutable reference to the reference sequence name.
pub fn reference_sequence_name_mut(&mut self) -> &mut BString {
&mut self.standard_fields.reference_sequence_name
}

/// Returns the feature start.
pub fn feature_start(&self) -> Position {
self.standard_fields.feature_start
}

/// Returns a mutable reference to the feature start.
pub fn feature_start_mut(&mut self) -> &mut Position {
&mut self.standard_fields.feature_start
}

/// Returns the feature end.
pub fn feature_end(&self) -> Option<Position> {
self.standard_fields.feature_end
}

/// Returns a mutable reference to the feature end.
pub fn feature_end_mut(&mut self) -> &mut Option<Position> {
&mut self.standard_fields.feature_end
}
}

impl super::Record<3> for RecordBuf<3> {
Expand Down Expand Up @@ -117,20 +132,40 @@ impl RecordBuf<4> {
self.standard_fields.reference_sequence_name.as_ref()
}

/// Returns a mutable reference to the reference sequence name.
pub fn reference_sequence_name_mut(&mut self) -> &mut BString {
&mut self.standard_fields.reference_sequence_name
}

/// Returns the feature start.
pub fn feature_start(&self) -> Position {
self.standard_fields.feature_start
}

/// Returns a mutable reference to the feature start.
pub fn feature_start_mut(&mut self) -> &mut Position {
&mut self.standard_fields.feature_start
}

/// Returns the feature end.
pub fn feature_end(&self) -> Option<Position> {
self.standard_fields.feature_end
}

/// Returns a mutable reference to the feature end.
pub fn feature_end_mut(&mut self) -> &mut Option<Position> {
&mut self.standard_fields.feature_end
}

/// Returns the name.
pub fn name(&self) -> Option<&BStr> {
self.standard_fields.name.as_ref().map(|name| name.as_ref())
}

/// Returns a mutable reference to the name.
pub fn name_mut(&mut self) -> &mut Option<BString> {
&mut self.standard_fields.name
}
}

impl super::Record<4> for RecordBuf<4> {
Expand Down Expand Up @@ -169,25 +204,50 @@ impl RecordBuf<5> {
self.standard_fields.reference_sequence_name.as_ref()
}

/// Returns a mutable reference to the reference sequence name.
pub fn reference_sequence_name_mut(&mut self) -> &mut BString {
&mut self.standard_fields.reference_sequence_name
}

/// Returns the feature start.
pub fn feature_start(&self) -> Position {
self.standard_fields.feature_start
}

/// Returns a mutable reference to the feature start.
pub fn feature_start_mut(&mut self) -> &mut Position {
&mut self.standard_fields.feature_start
}

/// Returns the feature end.
pub fn feature_end(&self) -> Option<Position> {
self.standard_fields.feature_end
}

/// Returns a mutable reference to the feature end.
pub fn feature_end_mut(&mut self) -> &mut Option<Position> {
&mut self.standard_fields.feature_end
}

/// Returns the name.
pub fn name(&self) -> Option<&BStr> {
self.standard_fields.name.as_ref().map(|name| name.as_ref())
}

/// Returns a mutable reference to the name.
pub fn name_mut(&mut self) -> &mut Option<BString> {
&mut self.standard_fields.name
}

/// Returns the score.
pub fn score(&self) -> u16 {
self.standard_fields.score
}

/// Returns a mutable reference to the score.
pub fn score_mut(&mut self) -> &mut u16 {
&mut self.standard_fields.score
}
}

impl super::Record<5> for RecordBuf<5> {
Expand Down Expand Up @@ -226,30 +286,60 @@ impl RecordBuf<6> {
self.standard_fields.reference_sequence_name.as_ref()
}

/// Returns a mutable reference to the reference sequence name.
pub fn reference_sequence_name_mut(&mut self) -> &mut BString {
&mut self.standard_fields.reference_sequence_name
}

/// Returns the feature start.
pub fn feature_start(&self) -> Position {
self.standard_fields.feature_start
}

/// Returns a mutable reference to the feature start.
pub fn feature_start_mut(&mut self) -> &mut Position {
&mut self.standard_fields.feature_start
}

/// Returns the feature end.
pub fn feature_end(&self) -> Option<Position> {
self.standard_fields.feature_end
}

/// Returns a mutable reference to the feature end.
pub fn feature_end_mut(&mut self) -> &mut Option<Position> {
&mut self.standard_fields.feature_end
}

/// Returns the name.
pub fn name(&self) -> Option<&BStr> {
self.standard_fields.name.as_ref().map(|name| name.as_ref())
}

/// Returns a mutable reference to the name.
pub fn name_mut(&mut self) -> &mut Option<BString> {
&mut self.standard_fields.name
}

/// Returns the score.
pub fn score(&self) -> u16 {
self.standard_fields.score
}

/// Returns a mutable reference to the score.
pub fn score_mut(&mut self) -> &mut u16 {
&mut self.standard_fields.score
}

/// Returns the strand.
pub fn strand(&self) -> Option<Strand> {
self.standard_fields.strand
}

/// Returns a mutable reference to the strand.
pub fn strand_mut(&mut self) -> &mut Option<Strand> {
&mut self.standard_fields.strand
}
}

impl super::Record<6> for RecordBuf<6> {
Expand Down

0 comments on commit 97d4b8a

Please sign in to comment.