Skip to main content

Reference

Struct Reference 

Source
pub struct Reference { /* private fields */ }
Expand description

The Reference model: a class-specific overlay reachable through accessor methods.

All shared bibliographic data (id, title, contributors, dates, publisher, …) lives inside the class-specific payload in extension. The accessor methods (id(), title(), etc.) dispatch through the extension and are the public read path; the typed setters (set_id, …) are the public mutation path.

Implementations§

Source§

impl InputReference

Source

pub fn identifiers(&self) -> &SupplementaryIdentifiers

Return all supplementary standardized identifiers.

Source

pub fn identifier(&self, name: &str) -> Option<&str>

Return one supplementary standardized identifier.

Source

pub fn insert_identifier( &mut self, name: IdentifierName, value: impl Into<String>, ) -> Option<String>

Insert one supplementary standardized identifier.

Source

pub fn class(&self) -> ReferenceClass

Return the typed class discriminator.

Source

pub fn extension(&self) -> &ClassExtension

Return the active class-specific overlay.

Source

pub fn extension_mut(&mut self) -> &mut ClassExtension

Return the mutable active class-specific overlay.

Source

pub fn as_monograph(&self) -> Option<&Monograph>

Return monograph data when this reference is a monograph.

Source

pub fn as_collection_component(&self) -> Option<&CollectionComponent>

Return collection-component data when this reference is a collection component.

Source

pub fn as_serial_component(&self) -> Option<&SerialComponent>

Return serial-component data when this reference is a serial component.

Source

pub fn as_collection(&self) -> Option<&Collection>

Return collection data when this reference is a collection.

Source

pub fn as_serial(&self) -> Option<&Serial>

Return serial data when this reference is a serial.

Return legal-case data when this reference is a legal case.

Source

pub fn as_statute(&self) -> Option<&Statute>

Return statute data when this reference is a statute.

Source

pub fn as_treaty(&self) -> Option<&Treaty>

Return treaty data when this reference is a treaty.

Source

pub fn as_hearing(&self) -> Option<&Hearing>

Return hearing data when this reference is a hearing.

Source

pub fn as_regulation(&self) -> Option<&Regulation>

Return regulation data when this reference is a regulation.

Source

pub fn as_brief(&self) -> Option<&Brief>

Return brief data when this reference is a brief.

Source

pub fn as_classic(&self) -> Option<&Classic>

Return classic-work data when this reference is a classic.

Source

pub fn as_patent(&self) -> Option<&Patent>

Return patent data when this reference is a patent.

Source

pub fn as_dataset(&self) -> Option<&Dataset>

Return dataset data when this reference is a dataset.

Source

pub fn as_standard(&self) -> Option<&Standard>

Return standard data when this reference is a standard.

Source

pub fn as_software(&self) -> Option<&Software>

Return software data when this reference is software.

Source

pub fn as_event(&self) -> Option<&Event>

Return event data when this reference is an event.

Source

pub fn as_audio_visual(&self) -> Option<&AudioVisualWork>

Return audio-visual data when this reference is audio-visual.

Source

pub fn unknown_class(&self) -> Option<&UnknownClassData>

Return unknown-class data when this reference names an unknown class.

Source

pub fn numbering_value(&self, numbering_type: &NumberingType) -> Option<String>

Return the numbering value for an arbitrary numbering kind.

Source

pub fn id(&self) -> Option<RefID>

Return the reference ID.

Source

pub fn author(&self) -> Option<Contributor>

Return the author.

Source

pub fn editor(&self) -> Option<Contributor>

Source

pub fn local_editor(&self) -> Option<Contributor>

Return an editor attached directly to this work, excluding an enclosing container’s editor.

Source

pub fn translator(&self) -> Option<Contributor>

Return the translator.

Source

pub fn publisher(&self) -> Option<Publisher>

Return the publisher.

Source

pub fn contributor(&self, role: ContributorRole) -> Option<Contributor>

Returns contributors matching role for any reference class that carries a contributors list.

Returns None if no contributors with the given role exist. Returns a single Contributor directly, or folds multiple into a ContributorList.

Source

pub fn contributor_entries( &self, role: &ContributorRole, ) -> Vec<&ContributorEntry>

Return all contributor entries matching the requested role.

Source

pub fn all_contributor_entries(&self) -> &[ContributorEntry]

Return all contributor entries regardless of role.

Source

pub fn title(&self) -> Option<Title>

Return the title.

Source

pub fn volume_title(&self) -> Option<String>

Return the title of an individual volume.

Source

pub fn created(&self) -> Option<DateValue>

Return the creation or origination date.

Source

pub fn issued(&self) -> Option<DateValue>

Return the explicit publication or release date.

Source

pub fn effective_issued_date(&self) -> Option<DateValue>

Return the effective issued date, falling back to the created date when no explicit issued date is present.

Source

pub fn copyright(&self) -> Option<DateValue>

Return the copyright year, a publication-year substitute used when the true issue date is unknown (GB/T 7714 §7.5.4.3’s c1988).

Source

pub fn printing(&self) -> Option<DateValue>

Return the printing/impression year, another publication-year substitute (GB/T 7714 §7.5.4.3’s 1995印刷).

Source

pub fn doi(&self) -> Option<String>

Return the DOI.

Source

pub fn ads_bibcode(&self) -> Option<String>

Return the ADS bibcode.

Source

pub fn note(&self) -> Option<RichText>

Return the note.

Source

pub fn url(&self) -> Option<Url>

Return the URL.

Source

pub fn publisher_place(&self) -> Option<String>

Return the publisher place.

Source

pub fn publisher_str(&self) -> Option<String>

Return the publisher as a string.

Source

pub fn genre(&self) -> Option<String>

Return the genre/type as string, normalized to canonical kebab-case.

Source

pub fn archive(&self) -> Option<String>

Return the archive or repository name.

Source

pub fn archive_location(&self) -> Option<String>

Return the archive shelfmark or repository location.

Source

pub fn archive_name(&self) -> Option<MultilingualString>

Return the archive name from structured ArchiveInfo.

Source

pub fn archive_place(&self) -> Option<String>

Return the archive geographic place from structured ArchiveInfo.

Source

pub fn archive_collection(&self) -> Option<String>

Return the archive collection name from structured ArchiveInfo.

Source

pub fn archive_collection_id(&self) -> Option<String>

Return the archive collection identifier from structured ArchiveInfo.

Source

pub fn archive_series(&self) -> Option<String>

Return the archive series from structured ArchiveInfo.

Source

pub fn archive_box(&self) -> Option<String>

Return the archive box number from structured ArchiveInfo.

Source

pub fn archive_folder(&self) -> Option<String>

Return the archive folder from structured ArchiveInfo.

Source

pub fn archive_item(&self) -> Option<String>

Return the archive item identifier from structured ArchiveInfo.

Source

pub fn archive_url(&self) -> Option<Url>

Return the archive URL from structured ArchiveInfo.

Source

pub fn status(&self) -> Option<String>

Return the publication status.

Source

pub fn eprint_id(&self) -> Option<String>

Return the eprint identifier.

Source

pub fn eprint_server(&self) -> Option<String>

Return the eprint server name.

Source

pub fn eprint_class(&self) -> Option<String>

Return the eprint subject class.

Source

pub fn medium(&self) -> Option<String>

Return the medium, normalized to canonical kebab-case.

Source

pub fn version(&self) -> Option<String>

Return the version.

Source

pub fn scale(&self) -> Option<String>

Return the cartographic scale.

Source

pub fn abstract_text(&self) -> Option<RichText>

Return the abstract.

Source

pub fn container_title(&self) -> Option<Title>

Return the container-style title for parent works, reporters, or codes.

Source

pub fn collection_title(&self) -> Option<Title>

Return the series or collection title for a parent work.

Source

pub fn volume(&self) -> Option<NumOrStr>

Return the volume.

Source

pub fn collection_number(&self) -> Option<String>

Return the collection number (series number).

Source

pub fn issue(&self) -> Option<NumOrStr>

Return the issue.

Source

pub fn pages(&self) -> Option<NumOrStr>

Return the pages.

Source

pub fn authority(&self) -> Option<String>

Return the authority (court, legislative body, standards org, etc.).

Source

pub fn reporter(&self) -> Option<String>

Return the reporter (legal reporter series).

Source

pub fn code(&self) -> Option<String>

Return the code (legal code abbreviation).

Source

pub fn section(&self) -> Option<String>

Return the section identifier for legal, classic, or serial-component references.

Source

pub fn number(&self) -> Option<String>

Return the generic document number.

Source

pub fn report_number(&self) -> Option<String>

Return the report identifier.

Source

pub fn edition(&self) -> Option<String>

Return the edition.

Source

pub fn accessed(&self) -> Option<DateValue>

Return the accessed date.

Source

pub fn unknown_fields(&self) -> Option<&BTreeMap<String, Value>>

Return the forward-compat unknown_fields captured for this reference.

Returns None for unknown-class references: their fields are kept wholesale in UnknownClassData::fields and reported separately via the unknown-class warning.

Source

pub fn original_date(&self) -> Option<DateValue>

Return the original publication date.

Source

pub fn original_title(&self) -> Option<Title>

Return the original title.

Source

pub fn original_publisher_str(&self) -> Option<String>

Return the original publisher as a string.

Source

pub fn original_publisher_place(&self) -> Option<String>

Return the original publisher place.

Source

pub fn isbn(&self) -> Option<String>

Return the ISBN.

Source

pub fn issn(&self) -> Option<String>

Return the ISSN.

Source

pub fn keywords(&self) -> Option<Vec<String>>

Return the Keywords.

Source

pub fn language(&self) -> Option<LangID>

Return the language.

Source

pub fn field_languages(&self) -> &HashMap<String, LangID>

Return field-level language overrides.

Source

pub fn set_id(&mut self, id: impl Into<RefID>)

Set the reference ID on the class-specific extension.

For unknown-class references the id is stored as a JsonValue::String inside UnknownClassData::fields["id"]. The wire schema requires id: string, so round-trip is lossless for valid inputs.

Source

pub fn ref_type(&self) -> String

Return the reference type as a string (CSL-compatible).

Source

pub fn normalize_contributors(&mut self)

Fold legacy contributor shorthands (author, editor, translator) into the canonical contributors vec on this reference and, when it has one, on its embedded container.

Deserialized references are already normalized as part of their #[serde(from = "...Deser")] conversion; this exists for references built directly in Rust — such as the biblatex converter — whose shorthand fields are skip_serializing and would otherwise be silently dropped on write. Idempotent — safe to call on an already-normalized reference.

Recurses into container only; original, event, and reviewed relations are not visited.

Source§

impl InputReference

Source

pub fn Monograph(reference: Box<Monograph>) -> InputReference

Construct a monograph reference (transitional; see block note above).

Source

pub fn CollectionComponent( reference: Box<CollectionComponent>, ) -> InputReference

Construct a collection-component reference.

Source

pub fn SerialComponent(reference: Box<SerialComponent>) -> InputReference

Construct a serial-component reference.

Source

pub fn Collection(reference: Box<Collection>) -> InputReference

Construct a collection reference.

Source

pub fn Serial(reference: Box<Serial>) -> InputReference

Construct a serial reference.

Source

pub fn LegalCase(reference: Box<LegalCase>) -> InputReference

Construct a legal-case reference.

Source

pub fn Statute(reference: Box<Statute>) -> InputReference

Construct a statute reference.

Source

pub fn Treaty(reference: Box<Treaty>) -> InputReference

Construct a treaty reference.

Source

pub fn Hearing(reference: Box<Hearing>) -> InputReference

Construct a hearing reference.

Source

pub fn Regulation(reference: Box<Regulation>) -> InputReference

Construct a regulation reference.

Source

pub fn Brief(reference: Box<Brief>) -> InputReference

Construct a brief reference.

Source

pub fn Classic(reference: Box<Classic>) -> InputReference

Construct a classic reference.

Source

pub fn Patent(reference: Box<Patent>) -> InputReference

Construct a patent reference.

Source

pub fn Dataset(reference: Box<Dataset>) -> InputReference

Construct a dataset reference.

Source

pub fn Standard(reference: Box<Standard>) -> InputReference

Construct a standard reference.

Source

pub fn Software(reference: Box<Software>) -> InputReference

Construct a software reference.

Source

pub fn Event(reference: Box<Event>) -> InputReference

Construct an event reference.

Source

pub fn AudioVisual(reference: Box<AudioVisualWork>) -> InputReference

Construct an audio-visual reference.

Source

pub fn Unknown(reference: Box<UnknownClassData>) -> InputReference

Construct an unknown-class reference.

Trait Implementations§

Source§

impl Clone for InputReference

Source§

fn clone(&self) -> InputReference

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InputReference

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for InputReference

Source§

fn deserialize<D>( deserializer: D, ) -> Result<InputReference, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Reference> for InputReference

Source§

fn from(legacy: Reference) -> InputReference

Converts to this type from the input type.
Source§

impl PartialEq for InputReference

Source§

fn eq(&self, other: &InputReference) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for InputReference

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for InputReference

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.