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
Int8Array(Vec<i8, Global>)

An 8-bit integer array (Bc).

Tuple Fields of Int8Array

0: Vec<i8, Global>
UInt8Array(Vec<u8, Global>)

An 8-bit unsigned integer array (BC).

Tuple Fields of UInt8Array

0: Vec<u8, Global>
Int16Array(Vec<i16, Global>)

A 16-bit integer array (Bs).

Tuple Fields of Int16Array

0: Vec<i16, Global>
UInt16Array(Vec<u16, Global>)

A 16-bit unsigned integer array (BS).

Tuple Fields of UInt16Array

0: Vec<u16, Global>
Int32Array(Vec<i32, Global>)

A 32-bit integer array (Bi).

Tuple Fields of Int32Array

0: Vec<i32, Global>
UInt32Array(Vec<u32, Global>)

A 32-bit unsigned integer array (BI).

Tuple Fields of UInt32Array

0: Vec<u32, Global>
FloatArray(Vec<f32, Global>)

A single-precision floating-point array (Bf).

Tuple Fields of FloatArray

0: Vec<f32, Global>

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.