Struct noodles::sam::header::header::Header[][src]

pub struct Header { /* fields omitted */ }
Expand description

A SAM header header.

The header describes file-level metadata. The format version is guaranteed to be set.

Implementations

Creates a SAM header header builder.

Examples

use noodles_sam::header::header::Header;
let builder = Header::builder();

Creates a header with a format version.

Examples

use noodles_sam::header::header::{Header, Version};
let header = Header::new(Version::new(1, 6));
assert_eq!(header.version(), Version::new(1, 6));

Returns the format version.

Examples

use noodles_sam::header::header::{Header, Version};
let header = Header::new(Version::new(1, 6));
assert_eq!(header.version(), Version::new(1, 6));

Returns a mutable reference to the format version.

Examples

use noodles_sam::header::header::{Header, Version};

let mut header = Header::new(Version::new(1, 6));
assert_eq!(header.version(), Version::new(1, 6));

*header.version_mut() = Version::new(1, 5);
assert_eq!(header.version(), Version::new(1, 5));

Returns the sort order.

Examples

use noodles_sam::header::header::Header;
let header = Header::default();
assert!(header.sort_order().is_none());

Returns the group order.

Examples

use noodles_sam::header::header::Header;
let header = Header::default();
assert!(header.group_order().is_none());

Returns the subsort order.

Examples

use noodles_sam::header::header::Header;
let header = Header::default();
assert!(header.subsort_order().is_none());

Returns the raw fields of the header.

This includes any field that is not specially handled by the structure itself. For example, this will not include the version field, as it is parsed and available as Self::version.

Examples

use noodles_sam::header::header::{Header, SortOrder, Tag, Version};

let header = Header::builder()
    .set_version(Version::new(1, 6))
    .insert(Tag::Other(String::from("zn")), String::from("noodles"))
    .build();

let fields = header.fields();
assert_eq!(fields.len(), 1);
assert_eq!(
    fields.get(&Tag::Other(String::from("zn"))),
    Some(&String::from("noodles"))
);

assert_eq!(fields.get(&Tag::Version), None);
assert_eq!(header.version(), Version::new(1, 6));

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

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

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

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

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

Compare self to key and return true if they are equal.

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.