#esp #esm #serde #ess #mw

nightly esl

A library for reading, writing and processing ESM/ESP/ESS files

45 releases

new 0.19.3 Oct 29, 2024
0.18.1 Oct 27, 2024
0.18.0 Oct 6, 2023
0.17.1 Dec 22, 2022
0.3.1 Mar 26, 2020

#503 in Encoding

Download history 20/week @ 2024-07-26 6/week @ 2024-08-02 90/week @ 2024-09-20 39/week @ 2024-09-27 1/week @ 2024-10-04 2/week @ 2024-10-11 3/week @ 2024-10-18 607/week @ 2024-10-25

613 downloads per month
Used in espa

MIT/Apache

460KB
11K SLoC

maintenance: actively developed

esl

A library for reading, writing and processing ESM/ESP/ESS files.

use esl::{CodePage, RecordSerde};
use esl::read::{RecordReadMode, Records};
use serde_serialize_seed::{ValueWithSeed, VecSerde};
use std::fs::File;
use std::io::{BufReader, BufWriter};

fn main() {
    if let Ok(input) = File::open("Morrowind.esm") {
        let mut input = BufReader::new(input);
        let records = Records::new(CodePage::Russian, RecordReadMode::Strict, false, 0, &mut input);
        let records = records.map(|x| {
            match x {
                Ok(mut x) => {
                    x.fit(false);
                    x
                },
                Err(e) => panic!("{}", e)
            }
        }).collect::<Vec<_>>();
        let output = File::create("Morrowind.esm.yaml").unwrap();
        serde_yaml::to_writer(
            BufWriter::new(output),
            &ValueWithSeed(&records[..], VecSerde(RecordSerde { code_page: None, omwsave: false }))
        ).unwrap();
    }
}

Dependencies

~5.5MB
~99K SLoC