Crate refer

source ·
Expand description

The refer crate provides a refer bibliographic format reader and writer. There is currently no Serde support.

The primary types in this crate are Reader and Writer for reading and writing refer data.

All records are parsed into the Record which contains an exhaustive list of refer format fields.

The errors which can occur when parsing and writing are described in the Error type.

Example

This example shows the simple API to read in and iterate over refer records from stdin, and then print the records out.

use refer::Reader;
use std::{io, error};

fn main() -> Result<(), Box<dyn error::Error>> {

    // construct a new reader
    let mut reader = Reader::new(io::stdin());

    // iterate over the records (borrowing them)
    for result in reader.records() {
        // records() returns a result
        let record = result?;
        // print the record line to stdout
        println!("{:?}", record);
    }

    Ok(())
}

Structs

  • The author field needs to be parsed specially as there can be multiple fields, and they are in a specific format.
  • An error that can happen when processing refer data.
  • A refer reader.
  • A refer record.
  • An owned iterator over the records of a refer file.
  • A borrowed iterator over the records of a refer file.
  • Create a styled String from refer record data.
  • A writer for a refer file.

Enums

  • The styles which are currently supported.