strfile

Crates.iostrfile
lib.rsstrfile
version0.1.2
sourcesrc
created_at2015-11-08 06:27:22.272574
updated_at2016-04-04 12:02:42.901388
descriptionTiny package to read strfile headers.
homepagehttps://github.com/lensvol/strfile-rs
repository
max_upload_size
id3381
size7,582
Kir (lensvol)

documentation

README

strfile-rs 0.1.0

crates.io badge TravisCI badge

Tiny crate for reading strfile headers, which are indexed representations of quote files used in fortune utility.

It is a hobby project, so pull requests are welcome. :)

Usage

extern crate strfile;

use strfile::Strfile;

fn display_strfile_header(header: &Strfile) {
    println!("Version:\t{}", header.version);
    println!("Strings:\t{}", header.number_of_strings);
    println!("Longest:\t{}", header.longest_length);
    println!("Shortest:\t{}", header.shortest_length);
    println!("Delimeter:\t{:?}", header.delim as char);

    println!("Randomized:\t{}", header.is_random());
    println!("Ordered:\t{}", header.is_ordered());
    println!("ROT13:\t\t{}", header.is_rotated());
    println!("Comments:\t{}\n", header.has_comments());
}   

let header = Strfile::parse("quotes.dat").unwrap();
let quotes = h.read_quotes(quotes_fn).unwrap();

println!("{:?}", header);

TODO

  • Support for headers generated on 64-bit machines
  • Construct headers from raw quotes file
  • Partial modification of headers (randomization of offsets, "encrypting" etc)
Commit count: 0

cargo fmt