#esp #esm #serde #ess #mw

nightly esl

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

45 releases

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

#513 in Encoding

Download history 128/week @ 2024-09-23 2/week @ 2024-09-30 5/week @ 2024-10-14 78/week @ 2024-10-21 619/week @ 2024-10-28 43/week @ 2024-11-04 16/week @ 2024-11-11 23/week @ 2024-11-18

779 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