1 unstable release

Uses old Rust 2015

0.1.0 Aug 3, 2017

#44 in #wiki

MIT/Apache

17KB
308 lines

PalmDB parser for Rust

"Build Status", link="https://travis-ci.org/pwoolcoc/palmdb-rs"

This crate implements a simple PalmDB parser for Rust. Why? Because .mobi files use it and I want to generate .mobi files, and the first step was getting familiar with the format. Next step will be adding a generator for PalmDB, and a parser & generator for Mobi

Documentation

Example

extern crate palmdb;

use std::fs::File;
use std::io::{self, Read};

use palmdb::PalmDB;

fn run() -> Result<(), io::Error> {
    let mut f = File::open("/path/to/palmdb/file")?;
    let mut input = vec![];
    f.read_to_end(&mut input)?;
    let db = PalmDB::parse(&input).expect("Could not parse db file");
}

fn main() {
    if let Err(_) = run() {
        ::std::process::exit(1);
    }
}

lib.rs:

Parser for the PalmDB format

This was created using a spec at the MobileRead wiki here: https://wiki.mobileread.com/..., as well as from the Calibre implementation here: https://github.com/kovidgoyal/calibre/...

Example

extern crate palmdb;
use palmdb::PalmDB;
use std::fs::File;
use std::io::Read;

let mut db_file = File::open("/path/to/some/palmdb/file")?;
let mut input = vec![];
db_file.read_to_end(&mut input)?;
let db = PalmDB::parse(&input).expect("Couldn't parse DB");

Dependencies

~3–5MB
~112K SLoC