Skip to content

MRRC

A Rust library for MARC bibliographic records, with Python bindings.

What MRRC Does

  • Reads and writes ISO 2709 (MARC21) binary format
  • Provides Python bindings with a pymarc-compatible API
  • Supports multiple serialization formats (JSON, XML, CSV, Dublin Core, MODS, BIBFRAME)
  • Handles MARC-8 and UTF-8 character encodings

Performance

Record parsing runs in Rust, and the Python bindings release the GIL during parsing so multi-threaded workloads parse in parallel. On a realistic corpus the Python wrapper reads substantially faster than pymarc — both per record and, further, through the parallel batch path — and the native Rust crate is faster still. See benchmarks for the full three-way comparison and how to benchmark mrrc on your own hardware and data.

Quick Example

from mrrc import MARCReader

for record in MARCReader("records.mrc"):
    print(record.title)
use mrrc::{MarcReader, RecordHelpers};
use std::fs::File;

let file = File::open("records.mrc")?;
let mut reader = MarcReader::new(file);
while let Some(record) = reader.read_record()? {
    if let Some(title) = record.title() {
        println!("{}", title);
    }
}

Getting Started

pymarc Users

MRRC's Python API is similar to pymarc but not identical. See the migration guide for specific differences.

Status

This library is experimental. APIs may change between versions.