Function libfar::farlib::test[][src]

pub fn test(file: &Vec<u8>) -> Result<FarArchive, String>
Expand description

Tests if a buffer is a valid FarArchive. Returns a FarArchive struct if it is, or an error if it is not.

Examples

use std::fs;
use libfar::farlib;
let buffer = fs::read("test.far").expect("Failed to read file");
let test = farlib::test(&buffer);
match test {
    Ok(archive) => {
        println!("test.far is a valid archive");
    },
    Err(e) => {
        println!("test.far is not a valid archive: {}", e);
    }
}