pub fn try_from_sam_record(
        reference_sequences: &sam::header::ReferenceSequences,
        sam_record: &sam::Record,
    ) -> io::Result<Self> {
        use crate::{reader::record::read_record, writer::sam_record::write_sam_record};

        let mut buf = Vec::new();
        write_sam_record(&mut buf, reference_sequences, sam_record)?;

        let mut reader = &buf[..];
        let mut record = Self::default();
        read_record(&mut reader, &mut Vec::new(), &mut record)?;

        Ok(record)
    }
/// Converts a SAM record to a BAM record.
///
/// # Examples
///
/// ```
/// # use std::io;
/// use noodles_bam as bam;
/// use noodles_sam::{self as sam, header::ReferenceSequences};
///
/// let reference_sequences = ReferenceSequences::default();
/// let sam_record = sam::Record::default();
///
/// let record = bam::Record::try_from_sam_record(&reference_sequences, &sam_record)?;
/// assert_eq!(record, bam::Record::default());
/// # Ok::<(), io::Error>(())
/// ```
Converts a SAM record to a BAM record.
Converts a SAM record to a BAM record .
pub fn try_from_sam_record(
        reference_sequences: &sam::header::ReferenceSequences,
        sam_record: &sam::Record,
    ) -> io::Result<Self> {
        use crate::{reader::record::read_record, writer::sam_record::write_sam_record};
        let mut buf = Vec::new();
        write_sam_record(&mut buf, reference_sequences, sam_record)?;
        let mut reader = &buf[..];
        let mut record = Self::default();
        read_record(&mut reader, &mut Vec::new(), &mut record)?;
        Ok(record)
    }
pub fn try_from_sam_record ( reference_sequences : & sam :: header :: ReferenceSequences , sam_record : & sam :: Record , ) -> io :: Result < Self > { use crate :: { reader :: record :: read_record , writer :: sam_record :: write_sam_record } ; let mut buf = Vec :: new ( ) ; write_sam_record ( & mut buf , reference_sequences , sam_record ) ? ; let mut reader = & buf [ .. ] ; let mut record = Self :: default ( ) ; read_record ( & mut reader , & mut Vec :: new ( ) , & mut record ) ? ; Ok ( record ) }
Converts a SAM record to a BAM record.
Converts a SAM record to a BAM record .
reference_sequences
&sam::header::ReferenceSequences
sam_record
&sam::Record
reference_sequences
&sam::header::ReferenceSequences
sam_record
&sam::Record
examples
None
use std::io;
use noodles_bam as bam;
use noodles_sam::{self as sam, header::ReferenceSequences}.

let reference_sequences = ReferenceSequences::default();
let sam_record = sam::Record::default().

let record = bam::Record::try_from_sam_record(&reference_sequences, &sam_record)?;
assert_eq!(record, bam::Record::default()).
use noodles_bam as bam ; use noodles_sam :: { self as sam header :: ReferenceSequences } . let reference_sequences = ReferenceSequences :: default () ; let sam_record = sam :: Record :: default () . let record = bam :: Record :: try_from_sam_record ( &reference_sequences &sam_record ) ? ; assert_eq! ( record bam :: Record :: default () ) .
ok::<(), io::error>(())
None