mod reader;
mod writer;
use crate::core::core_types::Orientation;
use crate::core::graph_dto::CoreGraphDTO;
use crate::error::PanResult;
use crate::traits::{GraphParser, GraphSerializer};
use std::io::{Read, Seek, Write};
pub struct GFACodec;
impl<R: Read + Seek> GraphParser<R> for GFACodec {
fn parse(&self, reader: &mut R) -> PanResult<CoreGraphDTO> {
reader::parse(reader)
}
}
impl GraphSerializer for GFACodec {
fn serialize(&self, graph: &CoreGraphDTO, writer: &mut dyn Write) -> PanResult<()> {
writer::write(graph, writer)
}
}
pub(crate) const GFA_HEADER: &[u8] = b"H\tVN:Z:1.0\n";
#[inline]
pub(crate) const fn orientation_byte(orientation: Orientation) -> u8 {
match orientation {
Orientation::Forward => b'+',
Orientation::Reverse => b'-',
}
}