Skip to content

Commit

Permalink
vcf/variant/record_buf/filters: Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Apr 1, 2024
1 parent b2db59f commit 89e34cd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions noodles-vcf/src/variant/record_buf/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,31 @@ pub struct Filters(IndexSet<String>);

impl Filters {
/// Creates a PASS filter.
///
/// # Examples
///
/// ```
/// use noodles_vcf::variant::record_buf::Filters;
/// let filters = Filters::pass();
/// assert!(filters.is_pass());
/// ```
pub fn pass() -> Self {
[String::from(PASS)].into_iter().collect()
}

/// Returns whether this is a PASS filter.
///
/// # Examples
///
/// ```
/// use noodles_vcf::variant::record_buf::Filters;
///
/// let filters = Filters::pass();
/// assert!(filters.is_pass());
///
/// let filters: Filters = [String::from("q10")].into_iter().collect();
/// assert!(!filters.is_pass());
/// ```
pub fn is_pass(&self) -> bool {
self.0
.first()
Expand Down

0 comments on commit 89e34cd

Please sign in to comment.