Skip to content

Commit

Permalink
Added GRanges::clone_with_data().
Browse files Browse the repository at this point in the history
  • Loading branch information
vsbuffalo committed Mar 6, 2024
1 parent b184631 commit 071a1bc
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/granges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,23 @@ where
}
}

// NOTE: not safe -- not used, so removed.
// impl<C, T> GRanges<C, T>
// where
// C: RangeContainer + Clone,
// {
// /// Create a new [`GRanges`] object by cloning the ranges of this one,
// /// and associating the supplied data with it (this consumes the data).
// pub fn clone_with_data<D>(&self, data: Option<D>) -> GRanges<C, D> {
// GRanges {
// ranges: self.ranges.clone(),
// data,
// }
// }
// }
impl<C, T> GRanges<C, T>
where
C: RangeContainer + Clone,
{
/// Create a new [`GRanges`] object by cloning the ranges of this one,
/// and associating the supplied data with it (this consumes the data).
///
/// Note that this is *not* guaranteed to be safe - a panic may result
/// if the developer has used ranges with invalid indices (e.g.
/// do not point to valid elements in the data container).
pub fn clone_with_data<D>(&self, data: Option<D>) -> GRanges<C, D> {
GRanges {
ranges: self.ranges.clone(),
data,
}
}
}

impl<C> GRangesEmpty<C>
where
Expand Down

0 comments on commit 071a1bc

Please sign in to comment.