Enum noodles::sam::record::data::field::Value [−][src]
pub enum Value {
Char(char),
Int(i64),
Float(f32),
String(String),
Hex(String),
Int8Array(Vec<i8, Global>),
UInt8Array(Vec<u8, Global>),
Int16Array(Vec<i16, Global>),
UInt16Array(Vec<u16, Global>),
Int32Array(Vec<i32, Global>),
UInt32Array(Vec<u32, Global>),
FloatArray(Vec<f32, Global>),
}
Expand description
A SAM record data field value.
Variants
Char(char)
A character (A
).
Tuple Fields of Char
0: char
Int(i64)
An integer (i
).
Tuple Fields of Int
0: i64
Float(f32)
A single-precision floating-point (f
).
Tuple Fields of Float
0: f32
String(String)
A string (Z
).
Tuple Fields of String
0: String
Hex(String)
A hex string (H
).
Tuple Fields of Hex
0: String
An 8-bit integer array (Bc
).
An 8-bit unsigned integer array (BC
).
A 16-bit integer array (Bs
).
A 16-bit unsigned integer array (BS
).
A 32-bit integer array (Bi
).
A 32-bit unsigned integer array (BI
).
A single-precision floating-point array (Bf
).
Implementations
Returns the type of the value.
Examples
use noodles_sam::record::data::field::{value::Type, Value};
assert_eq!(Value::Int(0).ty(), Type::Int);
Returns the subtype of the value.
Only arrays have subtypes.
Examples
use noodles_sam::record::data::field::{value::Subtype, Value};
assert_eq!(Value::UInt8Array(vec![0]).subtype(), Some(Subtype::UInt8));
assert_eq!(Value::Int(0).subtype(), None);
Returns the value as a character if it is a character.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::Char('a').as_char(), Some('a'));
assert_eq!(Value::Int(0).as_char(), None);
Returns whether the value is a character.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Char('a').is_char());
assert!(!Value::Int(0).is_char());
Returns the value as a 32-bit integer if it is an integer.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::Int(0).as_int(), Some(0));
assert_eq!(Value::Char('a').as_int(), None);
Returns whether the value is an integer.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Int(0).is_int());
assert!(!Value::Char('a').is_int());
Returns the value as a single-precision floating-point if it is a single-precision float-point.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::Float(0.0).as_float(), Some(0.0));
assert_eq!(Value::Int(0).as_float(), None);
Returns whether the value is a single-precision floating-point.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Float(0.0).is_float());
assert!(!Value::Int(0).is_float());
Returns the value as a string slice if it is a string slice.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::String(String::from("noodles")).as_str(), Some("noodles"));
assert_eq!(Value::Int(0).as_str(), None);
Returns whether the value is a string.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::String(String::from("noodles")).is_str());
assert!(!Value::Int(0).is_str());
Returns the value as a string slice of hex if it is a string slice of hex.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::Hex(String::from("cafe")).as_hex(), Some("cafe"));
assert_eq!(Value::Int(0).as_hex(), None);
Returns whether the value is a hex string.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Hex(String::from("cafe")).is_hex());
assert!(!Value::Int(0).is_hex());
Returns the value as an array of 8-bit integers if it is an array of 8-bit integers.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::Int8Array(vec![0]).as_int8_array(), Some(&[0][..]));
assert_eq!(Value::Int(0).as_int8_array(), None);
Returns whether the value is an 8-bit integer array.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Int8Array(vec![0]).is_int8_array());
assert!(!Value::Int(0).is_int8_array());
Returns the value as an array of 8-bit unsigned integers if it is an array of 8-bit unsigned integers.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::UInt8Array(vec![0]).as_uint8_array(), Some(&[0][..]));
assert_eq!(Value::Int(0).as_uint8_array(), None);
Returns whether the value is an 8-bit unsigned integer array.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::UInt8Array(vec![0]).is_uint8_array());
assert!(!Value::Int(0).is_uint8_array());
Returns the value as an array of 16-bit integers if it is an array of 16-bit integers.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::Int16Array(vec![0]).as_int16_array(), Some(&[0][..]));
assert_eq!(Value::Int(0).as_int16_array(), None);
Returns whether the value is a 16-bit integer array.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Int16Array(vec![0]).is_int16_array());
assert!(!Value::Int(0).is_int16_array());
Returns the value as an array of 16-bit unsigned integers if it is an array of 16-bit unsigned integers.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::UInt16Array(vec![0]).as_uint16_array(), Some(&[0][..]));
assert_eq!(Value::Int(0).as_uint16_array(), None);
Returns whether the value is a 16-bit unsigned integer array.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::UInt16Array(vec![0]).is_uint16_array());
assert!(!Value::Int(0).is_int16_array());
Returns the value as an array of 32-bit integers if it is an array of 32-bit integers.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::Int32Array(vec![0]).as_int32_array(), Some(&[0][..]));
assert_eq!(Value::Int(0).as_int32_array(), None);
Returns whether the value is a 32-bit integer array.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Int32Array(vec![0]).is_int32_array());
assert!(!Value::Int(0).is_int16_array());
Returns the value as an array of 32-bit unsigned integers if it is an array of 32-bit unsigned integers.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::UInt32Array(vec![0]).as_uint32_array(), Some(&[0][..]));
assert_eq!(Value::Int(0).as_uint32_array(), None);
Returns whether the value is a 32-bit unsigned integer array.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::UInt32Array(vec![0]).is_uint32_array());
assert!(!Value::Int(0).is_int32_array());
Returns the value as an array of single-precision floating-points if it is an array of single-precision floating-points.
Examples
use noodles_sam::record::data::field::Value;
assert_eq!(Value::FloatArray(vec![0.0]).as_float_array(), Some(&[0.0][..]));
assert_eq!(Value::Int(0).as_float_array(), None);
Returns whether the value is a 32-bit integer array.
Examples
use noodles_sam::record::data::field::Value;
assert!(Value::Int32Array(vec![0]).is_int32_array());
assert!(!Value::Int(0).is_int16_array());
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Value
impl UnwindSafe for Value
Blanket Implementations
Mutably borrows from an owned value. Read more