pub fn dump(mmv_path: &Path) -> Result<MMV, MMVDumpError> {
    let mut mmv_bytes = Vec::new();
    let mut file = File::open(mmv_path)?;
    file.read_to_end(&mut mmv_bytes)?;

    let mut cursor = Cursor::new(mmv_bytes);
    
    let hdr = Header::from_reader(&mut cursor)?;

    let mut indom_toc = None;
    let mut instance_toc = None;
    let mut metric_toc = None;
    let mut value_toc = None;
    let mut string_toc = None;

    for i in 0..hdr.toc_count {
        let toc_position = cursor.position();
        let mut toc = TocBlk::from_reader(&mut cursor)?;
        toc._toc_index = i;
        toc._mmv_offset = toc_position;

        if toc.sec == INDOM_TOC_CODE { indom_toc = Some(toc); }
        else if toc.sec == INSTANCE_TOC_CODE { instance_toc = Some(toc); }
        else if toc.sec == METRIC_TOC_CODE { metric_toc = Some(toc); }
        else if toc.sec == VALUES_TOC_CODE { value_toc = Some(toc); }
        else if toc.sec == STRINGS_TOC_CODE { string_toc = Some(toc); }
    }

    if metric_toc.is_none() {
        return_mmvdumperror!("Metric TOC absent", 0);
    }
    if value_toc.is_none() {
        return_mmvdumperror!("String TOC absent", 0);
    }

    let indom_blks = blks_from_toc!(indom_toc, IndomBlk, cursor);
    let instance_blks = blks_from_toc!(instance_toc, InstanceBlk, hdr.version, cursor);
    let metric_blks = blks_from_toc!(metric_toc, MetricBlk, hdr.version, cursor);
    let value_blks = blks_from_toc!(value_toc, ValueBlk, cursor);
    let string_blks = blks_from_toc!(string_toc, StringBlk, cursor);

    Ok(
        MMV {
            header: hdr,
            metric_toc: metric_toc.unwrap(),
            value_toc: value_toc.unwrap(),
            string_toc: string_toc,
            indom_toc: indom_toc,
            instance_toc: instance_toc,
            indom_blks: indom_blks,
            instance_blks: instance_blks,
            metric_blks: metric_blks,
            value_blks: value_blks,
            string_blks: string_blks
        }
    )
}
/// Returns an `MMV` structure by reading and parsing the MMV
/// file stored at `mmv_path`
Returns an `MMV` structure by reading and parsing the MMV
file stored at `mmv_path`
Returns an ` MMV ` structure by reading and parsing the MMV file stored at ` mmv_path `
pub fn dump(mmv_path: &Path) -> Result<MMV, MMVDumpError> {
    let mut mmv_bytes = Vec::new();
    let mut file = File::open(mmv_path)?;
    file.read_to_end(&mut mmv_bytes)?;
    let mut cursor = Cursor::new(mmv_bytes);
    let hdr = Header::from_reader(&mut cursor)?;
    let mut indom_toc = None;
    let mut instance_toc = None;
    let mut metric_toc = None;
    let mut value_toc = None;
    let mut string_toc = None;
    for i in 0..hdr.toc_count {
        let toc_position = cursor.position();
        let mut toc = TocBlk::from_reader(&mut cursor)?;
        toc._toc_index = i;
        toc._mmv_offset = toc_position;
        if toc.sec == INDOM_TOC_CODE { indom_toc = Some(toc); }
        else if toc.sec == INSTANCE_TOC_CODE { instance_toc = Some(toc); }
        else if toc.sec == METRIC_TOC_CODE { metric_toc = Some(toc); }
        else if toc.sec == VALUES_TOC_CODE { value_toc = Some(toc); }
        else if toc.sec == STRINGS_TOC_CODE { string_toc = Some(toc); }
    }
    if metric_toc.is_none() {
        return_mmvdumperror!("Metric TOC absent", 0);
    }
    if value_toc.is_none() {
        return_mmvdumperror!("String TOC absent", 0);
    }
    let indom_blks = blks_from_toc!(indom_toc, IndomBlk, cursor);
    let instance_blks = blks_from_toc!(instance_toc, InstanceBlk, hdr.version, cursor);
    let metric_blks = blks_from_toc!(metric_toc, MetricBlk, hdr.version, cursor);
    let value_blks = blks_from_toc!(value_toc, ValueBlk, cursor);
    let string_blks = blks_from_toc!(string_toc, StringBlk, cursor);
    Ok(
        MMV {
            header: hdr,
            metric_toc: metric_toc.unwrap(),
            value_toc: value_toc.unwrap(),
            string_toc: string_toc,
            indom_toc: indom_toc,
            instance_toc: instance_toc,
            indom_blks: indom_blks,
            instance_blks: instance_blks,
            metric_blks: metric_blks,
            value_blks: value_blks,
            string_blks: string_blks
        }
    )
}
pub fn dump ( mmv_path : & Path ) -> Result < MMV , MMVDumpError > { let mut mmv_bytes = Vec :: new ( ) ; let mut file = File :: open ( mmv_path ) ? ; file . read_to_end ( & mut mmv_bytes ) ? ; let mut cursor = Cursor :: new ( mmv_bytes ) ; let hdr = Header :: from_reader ( & mut cursor ) ? ; let mut indom_toc = None ; let mut instance_toc = None ; let mut metric_toc = None ; let mut value_toc = None ; let mut string_toc = None ; for i in 0 .. hdr . toc_count { let toc_position = cursor . position ( ) ; let mut toc = TocBlk :: from_reader ( & mut cursor ) ? ; toc . _toc_index = i ; toc . _mmv_offset = toc_position ; if toc . sec == INDOM_TOC_CODE { indom_toc = Some ( toc ) ; } else if toc . sec == INSTANCE_TOC_CODE { instance_toc = Some ( toc ) ; } else if toc . sec == METRIC_TOC_CODE { metric_toc = Some ( toc ) ; } else if toc . sec == VALUES_TOC_CODE { value_toc = Some ( toc ) ; } else if toc . sec == STRINGS_TOC_CODE { string_toc = Some ( toc ) ; } } if metric_toc . is_none ( ) { return_mmvdumperror ! ( " " 0 ) ; } if value_toc . is_none ( ) { return_mmvdumperror ! ( " " 0 ) ; } let indom_blks = blks_from_toc ! ( indom_toc IndomBlk cursor ) ; let instance_blks = blks_from_toc ! ( instance_toc InstanceBlk hdr version cursor ) ; let metric_blks = blks_from_toc ! ( metric_toc MetricBlk hdr version cursor ) ; let value_blks = blks_from_toc ! ( value_toc ValueBlk cursor ) ; let string_blks = blks_from_toc ! ( string_toc StringBlk cursor ) ; Ok ( MMV { header : hdr , metric_toc : metric_toc . unwrap ( ) , value_toc : value_toc . unwrap ( ) , string_toc : string_toc , indom_toc : indom_toc , instance_toc : instance_toc , indom_blks : indom_blks , instance_blks : instance_blks , metric_blks : metric_blks , value_blks : value_blks , string_blks : string_blks } ) }
Returns an `MMV` structure by reading and parsing the MMV
file stored at `mmv_path`
Returns an ` MMV ` structure by reading and parsing the MMV file stored at ` mmv_path `
mmv_path
&Path