<commit_before>pub mod error;

use error::Result;

#[derive(Debug)]
pub struct Instruction {
    foo: u8
}

impl Instruction {
    fn new() -> Instruction {
        Instruction {
            foo: 0
        }
    }
}

pub fn from_file(filename: &str) {
    // TODO
}

pub fn from_vec(bytes: &Vec<u8>) -> Result<Vec<Instruction>> {
    from_array(&bytes)
}

pub fn from_array(bytes: &[u8]) -> Result<Vec<Instruction>> {
    let mut ret = Vec::<Instruction>::new();
    ret.push(Instruction::new());
    // TODO
    Ok(ret)
}<commit_msg>reading from file<commit_after>pub mod error;

use error::Result;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;

#[derive(Debug)]
pub struct Instruction {
    foo: u8
}

impl Instruction {
    fn new() -> Instruction {
        Instruction {
            foo: 0
        }
    }
}

pub fn from_file(filename: &str) -> Result<Vec<Instruction>> {
    let path = Path::new(&filename);
    let mut file = try!(File::open(&path));
    let mut bytes = Vec::new();
    try!(file.read_to_end(&mut bytes));

    from_array(&bytes)
}

pub fn from_vec(bytes: &Vec<u8>) -> Result<Vec<Instruction>> {
    from_array(&bytes)
}

pub fn from_array(bytes: &[u8]) -> Result<Vec<Instruction>> {
    let mut ret = Vec::<Instruction>::new();
    ret.push(Instruction::new());
    // TODO
    Ok(ret)
}
{'fraction_non_alphanumeric': 0.17293233082706766, 'fraction_numerical': 0.006015037593984963, 'mean_word_length': 3.146417445482866, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4897227', 'n_tokens_mistral': 463, 'n_tokens_neox': 466, 'n_words': 106}