Skip to content

Commit

Permalink
vcf/variant/record_buf/samples/sample/value: Add conversion to crate:…
Browse files Browse the repository at this point in the history
…:variant::record::samples::series::Value
  • Loading branch information
zaeleus committed Feb 21, 2024
1 parent 202e4bb commit 419f93f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions noodles-vcf/src/variant/record_buf/samples/sample/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,15 @@ impl From<Vec<Option<String>>> for Value {
Self::Array(Array::String(values))
}
}

impl<'a> From<&'a Value> for crate::variant::record::samples::series::Value<'a> {
fn from(value_buf: &'a Value) -> Self {
match value_buf {
Value::Integer(n) => Self::Integer(*n),
Value::Float(n) => Self::Float(*n),
Value::Character(c) => Self::Character(*c),
Value::String(s) => Self::String(s.as_ref()),
Value::Array(array) => Self::Array(array.into()),
}
}
}

0 comments on commit 419f93f

Please sign in to comment.