Expand description
Citation File Format serde types and implementations.
This targets CFF 1.2.0 but may not support the entire specification.
The top level API mimics serde_yaml’s:
let cff = citeworks_cff::from_str(r#"
cff-version: 1.2.0
message:
If you dare use this commercial, closed-source, strangely versioned
software in your research, please at least cite it as below.
authors:
- family-names: Vader
name-suffix: né Skywalker
given-names: 'Anakin "Darth"'
- name: anonymous
title: Opaquity
version: opq-1234-XZVF-ACME-RLY
date-released: 2017-02-28
url: http://www.opaquity.com/
contact:
- name: Dark Side Software
address: DS-1 Orbital Battle Station, near Scarif
email: father@imperial-empire.com
tel: +850 (0)123-45-666
"#).unwrap();
assert_eq!(
cff
.authors[0]
.as_person()
.and_then(|his| his.family_names.as_deref()),
Some("Vader")
);Modules§
- identifiers
- Types and utilities for identifiers e.g. DOIs.
- names
- Types and utilities for names e.g. of authors.
- references
- Types and utilities for references to this or other works.
Structs§
Enums§
Functions§
- from_
reader - Deserialize CFF from an IO stream of YAML.
- from_
slice - Deserialize CFF from bytes of YAML text.
- from_
str - Deserialize CFF from a string of YAML text.
- to_
string - Serialize the given CFF as a String of YAML.
- to_vec
- Serialize the given CFF as a YAML byte vector.
- to_
writer - Serialize the given CFF as YAML into the IO stream.
Type Aliases§
- Result
- Alias for a
Resultwith the error typeserde_yaml::Error.