Struct noodles::sam::header::program::Program[][src]

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

A SAM header program.

A program describes any program that created, viewed, or mutated a SAM file. The program ID is guaranteed to be set.

Implementations

Creates a SAM header program builder.

Examples

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

Creates a program with an ID.

Examples

use noodles_sam::header::Program;
let program = Program::new("pg0");
assert_eq!(program.id(), "pg0");

Returns the program ID.

Examples

use noodles_sam::header::Program;
let program = Program::new("pg0");
assert_eq!(program.id(), "pg0");

Returns a mutable reference to the program ID.

Examples

use noodles_sam::header::Program;

let mut program = Program::new("pg0");
assert_eq!(program.id(), "pg0");

*program.id_mut() = String::from("pg1");
assert_eq!(program.id(), "pg1");

Returns the program name.

Examples

use noodles_sam::header::Program;
let program = Program::new("pg0");
assert!(program.name().is_none());

Returns the command line.

Examples

use noodles_sam::header::Program;
let program = Program::new("pg0");
assert!(program.command_line().is_none());

Returns the previous program ID.

Examples

use noodles_sam::header::Program;
let program = Program::new("pg0");
assert!(program.previous_id().is_none());

Returns the description.

Examples

use noodles_sam::header::Program;
let program = Program::new("pg0");
assert!(program.description().is_none());

Returns the program version.

Examples

use noodles_sam::header::Program;
let program = Program::new("pg0");
assert!(program.version().is_none());

Returns the raw fields of the program.

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

Examples

use noodles_sam::header::{program::Tag, Program};

let program = Program::builder()
    .set_id("pg0")
    .insert(Tag::Other(String::from("zn")), String::from("noodles"))
    .build()?;

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

assert_eq!(fields.get(&Tag::Id), None);
assert_eq!(program.id(), "pg0");

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

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.