### Selector Parsing and Macro Expansion Example Source: https://docs.rs/hayagriva/0.9.1/hayagriva/macro.select.html This example demonstrates the equivalence between parsing a selector string and constructing the same selector using the `select` macro. It highlights differences such as string literals for binding names and attributes, and the necessity of parentheses for non-atomic selectors in macro usage. ```rust use hayagriva::select; use hayagriva::Selector; // finds an article that is parented by a conference proceedings volume assert_eq!(Selector::parse("article > proceedings").unwrap(), select!(Article > Proceedings)); ``` ```rust // matches either a video or audio item or an artwork assert_eq!(Selector::parse("video | audio | artwork").unwrap(), select!(Video | Audio | Artwork)); ``` ```rust // matches anything that is parented by both a blog and a newspaper assert_eq!(Selector::parse("* > (blog | newspaper)").unwrap(), select!(* > (Blog | Newspaper))); ``` ```rust // matches anything with a URL or a parent with a URL and binds the entry with the attribute to the variable `i`. // Note that expressions like i:*[url] do not need parentheses in the parsed selector, but they do in the macro! assert_eq!(Selector::parse("i:*[url] | (* > i:*[url])").unwrap(), select!(("i":(*["url"])) | (* > ("i":(*["url"]))))); ``` -------------------------------- ### Get All Available Styles Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/enum.ArchivedStyle.html Retrieves a static slice containing all supported citation style variants. ```rust pub fn all() -> &'static [Self] ``` -------------------------------- ### Get Style Display Name Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/enum.ArchivedStyle.html Retrieves the full, human-readable display name of the citation style. ```rust pub fn display_name(self) -> &'static str ``` -------------------------------- ### Implement ToString for T Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.PersonError.html Allows any type T that implements Display to be converted into a String. This is a convenient way to get a string representation. ```rust impl ToString for T ``` -------------------------------- ### Get Name Particle Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Retrieves the non-dropping particle from the family name. ```rust pub fn name_particle(&self) -> Option<&str> ``` -------------------------------- ### Implement PartialEq for Formatting Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatting.html Enables equality comparison between Formatting instances. Use this to check if two formatting configurations are identical. ```rust fn eq(&self, other: &Formatting) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### equivalent Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.PersonRole.html Compares the current instance with a given key and returns true if they are equal. ```APIDOC ## equivalent ### Description Compares the current instance (`self`) with a given key (`key`) and returns `true` if they are equal, `false` otherwise. ### Method `equivalent(&self, key: &K) -> bool` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **bool** (bool) - `true` if `self` is equal to `key`, `false` otherwise. #### Response Example None ``` -------------------------------- ### Get Name Without Article Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Returns the name with any leading article removed. ```rust pub fn name_without_article(&self) -> &str ``` -------------------------------- ### Implement Clone for Formatting Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatting.html Provides functionality to create a duplicate of a Formatting instance. This is useful for copying formatting settings. ```rust fn clone(&self) -> Formatting ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Get Name Particles Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Retrieves all particles (dropping and non-dropping) from the family name. ```rust pub fn name_particles(&self) -> Option> ``` -------------------------------- ### BibliographyDriver Methods Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.BibliographyDriver.html Methods for initializing the driver, adding citations, and rendering the final bibliography. ```APIDOC ## BibliographyDriver Methods ### Description The BibliographyDriver is used to collect citation requests and render them into a formatted bibliography. ### Methods - **new()**: Creates a new instance of the BibliographyDriver. - **citation(req: CitationRequest)**: Adds a new citation to the driver using the provided request. - **finish(request: BibliographyRequest)**: Renders the final bibliography based on the collected citations and the provided request. ### Usage Example ```rust let mut driver = BibliographyDriver::new(); driver.citation(citation_request); let rendered = driver.finish(bibliography_request); ``` ``` -------------------------------- ### Get Name Without Particle Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Returns the family name excluding any non-dropping particle. ```rust pub fn name_without_particle(&self) -> &str ``` -------------------------------- ### Implement CloneToUninit for T Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.PersonError.html Nightly-only experimental API for cloning data into uninitialized memory. Use with caution. ```rust impl CloneToUninit for T ``` -------------------------------- ### Retrieve Style Object Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/enum.ArchivedStyle.html Gets the `Style` object associated with the current `ArchivedStyle` variant. ```rust pub fn get(self) -> Style ``` -------------------------------- ### Get Nth Numeric Value Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Numeric.html Retrieves the nth number from the set represented by the Numeric value. ```rust pub fn nth(&self, n: usize) -> Option ``` -------------------------------- ### Create CitationItem with Entry and Locator Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.CitationItem.html Constructs a new CitationItem with the entry and an optional locator. Other fields will default. ```rust pub fn with_locator(entry: &'a T, locator: Option>) -> Self ``` -------------------------------- ### Publisher::new Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Publisher.html Creates a new Publisher instance. ```APIDOC ## `Publisher::new` ### Description Create a new publisher. ### Method `pub fn new(name: Option, location: Option) -> Self` ### Parameters #### Query Parameters - **name** (Option) - Optional - The name of the publisher. - **location** (Option) - Optional - The physical location of the publisher. ### Response #### Success Response (200) - **Self** (Publisher) - A new Publisher instance. ### Request Example ```rust use hayagriva::types::Publisher; use hayagriva::types::FormatString; let publisher_name = Some(FormatString::new("Example Publisher")); let publisher_location = Some(FormatString::new("123 Main St")); let publisher = Publisher::new(publisher_name, publisher_location); ``` ### Response Example ```json { "name": "Example Publisher", "location": "123 Main St" } ``` ``` -------------------------------- ### Create BibliographyRequest Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.BibliographyRequest.html Constructor for BibliographyRequest. Use this to create a new bibliography request. ```rust pub fn new( style: &'a IndependentStyle, locale: Option, locale_files: &'a [Locale], ) -> Self ``` -------------------------------- ### Get Style Names in Hayagriva Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/enum.ArchivedStyle.html Retrieves the names of the citation style as recognized within Hayagriva. ```rust pub fn names(self) -> &'static [&'static str] ``` -------------------------------- ### TryFrom<&Entry> for Entry Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Entry.html Provides functionality to attempt conversion from a reference to Entry into an Entry. ```APIDOC ## type Error = TypeError ### Description The type returned in the event of a conversion error. ### Type `Error` ``` ```APIDOC ## fn try_from(entry: &Entry) -> Result ### Description Performs the conversion. ### Method `try_from` ``` -------------------------------- ### Get All CSL Locales Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/fn.locales.html Retrieves a list of all available CSL locales supported by the Hayagriva library. ```APIDOC ## GET /locales ### Description Get all CSL locales. ### Method GET ### Endpoint /locales ### Response #### Success Response (200) - **locales** (Vec) - A vector containing all available Locale objects. ``` -------------------------------- ### TransparentLocator::new Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.TransparentLocator.html Creates a new instance of TransparentLocator by wrapping a payload that implements PartialEq. ```APIDOC ## TransparentLocator::new ### Description Creates a new `TransparentLocator` which wraps the given payload. The payload must implement `PartialEq` and have a `'static` lifetime. ### Parameters #### Request Body - **payload** (T: PartialEq + 'static) - Required - The object to be wrapped for equality comparison. ### Response - **Self** (TransparentLocator) - A new instance of the locator. ``` -------------------------------- ### TryFrom and TryInto Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Library.html Documentation for the `TryFrom` and `TryInto` trait implementations, enabling fallible conversions between types. ```APIDOC ### impl TryFrom for T #### Description Provides fallible conversion from type `U` into type `T`. #### Type Alias - **Error** (`Infallible`) - The type returned in the event of a conversion error. #### Method - **try_from**(value: U) -> Result>::Error> Performs the conversion. ### impl TryInto for T #### Description Provides fallible conversion from type `T` into type `U`. #### Type Alias - **Error** (`>::Error`) - The type returned in the event of a conversion error. #### Method - **try_into**() -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Get Minimum of Two Person Instances Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Compares two Person instances and returns the minimum of the two. ```rust fn min(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### Get Maximum of Two Person Instances Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Compares two Person instances and returns the maximum of the two. ```rust fn max(self, other: Self) -> Self where Self: Sized, ``` -------------------------------- ### SentenceCase Constructor and Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/lang/struct.SentenceCase.html Information on how to construct a SentenceCase instance and its available trait implementations. ```APIDOC ### impl SentenceCase #### `new()` Construct a new `SentenceCase` with the default values. ### Trait Implementations - **`Clone`**: Allows creating a duplicate of a `SentenceCase` instance. - **`Debug`**: Enables formatting for debugging purposes. - **`Default`**: Provides a default `SentenceCase` configuration. - **`From for Case`**: Enables conversion from `SentenceCase` to `Case`. - **`PartialEq`**: Allows comparison for equality between `SentenceCase` instances. - **`Eq`**: Indicates that equality is reflexive, symmetric, and transitive. - **`Copy`**: Allows `SentenceCase` to be copied implicitly. - **`StructuralPartialEq`**: For structural equality comparisons. **Auto Trait Implementations**: `Freeze`, `RefUnwindSafe`, `Send`, `Sync`, `Unpin`, `UnwindSafe`. **Blanket Implementations**: `Any`, `Borrow`, `BorrowMut`, `CloneToUninit`, `Equivalent`, `From for T`, `Into`, `ToOwned`, `TryFrom`. ``` -------------------------------- ### Implement CloneToUninit for T (Nightly) Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.LocatorPayload.html A nightly-only experimental API for performing copy-assignment from self to an uninitialized destination. Use with caution. ```rust impl 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 ``` -------------------------------- ### Get Style CSL ID Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/enum.ArchivedStyle.html Retrieves the Citation Style Language (CSL) identifier for the citation style. ```rust pub fn csl_id(self) -> &'static str ``` -------------------------------- ### Get all CSL locales Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/fn.locales.html Retrieves all available CSL locales. This function is part of the hayagriva::archive module. ```rust pub fn locales() -> Vec ``` -------------------------------- ### CloneToUninit Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Date.html Provides a method to perform copy-assignment from self to a mutable pointer. This is an experimental, nightly-only API. ```APIDOC ## unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description Performs copy-assignment from `self` to `dest`. ### Method `unsafe fn clone_to_uninit` ### Parameters #### Path Parameters - **dest** (*mut u8) - Required - The destination pointer to copy to. ### Response Example (No specific response example provided for this method, as it operates on raw pointers.) ``` -------------------------------- ### CloneToUninit Trait Implementation (Nightly) Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.ElemChild.html Nightly-only experimental API for cloning to uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Implement Display for PersonError Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.PersonError.html Allows PersonError to be formatted as a string. This is the recommended way to get a user-friendly error message. ```rust impl Display for PersonError ``` -------------------------------- ### Parse YAML and Format Citations Source: https://docs.rs/hayagriva Demonstrates parsing a YAML bibliography string and using a BibliographyDriver to generate citations with a CSL style. ```rust use hayagriva::io::from_yaml_str; let yaml = r#" crazy-rich: type: Book title: Crazy Rich Asians author: Kwan, Kevin date: 2014 publisher: Anchor Books location: New York, NY, US "#; // Parse a bibliography let bib = from_yaml_str(yaml).unwrap(); assert_eq!(bib.get("crazy-rich").unwrap().date().unwrap().year, 2014); // Format the reference use std::fs; use hayagriva::{ BibliographyDriver, BibliographyRequest, BufWriteFormat, CitationItem, CitationRequest, }; use hayagriva::citationberg::{LocaleFile, IndependentStyle}; let en_locale = fs::read_to_string("tests/data/locales-en-US.xml").unwrap(); let locales = [LocaleFile::from_xml(&en_locale).unwrap().into()]; let style = fs::read_to_string("tests/data/art-history.csl").unwrap(); let style = IndependentStyle::from_xml(&style).unwrap(); let mut driver = BibliographyDriver::new(); for entry in bib.iter() { let items = vec![CitationItem::with_entry(entry)]; driver.citation(CitationRequest::from_items(items, &style, &locales)); } let result = driver.finish(BibliographyRequest { style: &style, locale: None, locale_files: &locales, }); for cite in result.citations { println!("{}", cite.citation) } ``` -------------------------------- ### Selector::apply Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.Selector.html Applies the selector to an entry and returns bound variables. ```APIDOC ## POST /Selector/apply ### Description Applies the selector to an Entry and returns the bound variables in a hash map if there was a match. ### Method POST ### Parameters #### Request Body - **selector** (Selector) - Required - The selector instance. - **entry** (Entry) - Required - The entry to apply the selector to. ### Response #### Success Response (200) - **bindings** (HashMap) - A map of bound variable names to their corresponding entries. ``` -------------------------------- ### Get Right Bracket Character Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.Brackets.html Returns the right bracket character for the current Brackets variant, if one exists. ```rust pub fn right(&self) -> Option ``` -------------------------------- ### Get Left Bracket Character Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.Brackets.html Returns the left bracket character for the current Brackets variant, if one exists. ```rust pub fn left(&self) -> Option ``` -------------------------------- ### Create CitationItem with All Fields Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.CitationItem.html Creates a new CitationItem by explicitly setting all its fields: entry, locator, locale, hidden status, and purpose. ```rust pub fn new( entry: &'a T, locator: Option>, locale: Option, hidden: bool, purpose: Option, ) -> Self ``` -------------------------------- ### Get Name with Given Name First Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Returns the full name with the given name first, followed by the family name. ```rust pub fn given_first(&self, initials: bool) -> String ``` -------------------------------- ### Create CitationItem with Entry Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.CitationItem.html Constructs a new CitationItem with only the entry provided. Other fields will default to their respective None or false values. ```rust pub fn with_entry(entry: &'a T) -> Self ``` -------------------------------- ### Get Single Numeric Value Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Numeric.html Returns the numeric value as an i32 if it represents a single number without any prefix or suffix. ```rust pub fn single_number(&self) -> Option ``` -------------------------------- ### Retrieve ArchivedStyle by Name Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/enum.ArchivedStyle.html Use this function to get a specific citation style by its name. Returns `None` if the style is not found. ```rust pub fn by_name(name: &str) -> Option ``` -------------------------------- ### Serialize for Entry Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Entry.html Enables serialization of Entry instances. ```APIDOC ## fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> ### Description Serialize this value into the given Serde serializer. ### Method `serialize` ``` -------------------------------- ### Entry Identifier Management Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Entry.html Methods for getting and setting standard bibliographic identifiers such as DOI, ISBN, ISSN, PMID, PMCID, and ArXiv. ```APIDOC ## GET /entry/identifiers ### Description Retrieves standard bibliographic identifiers for the entry. ### Response #### Success Response (200) - **doi** (String) - The Digital Object Identifier. - **isbn** (String) - International Standard Book Number. - **issn** (String) - International Standard Serial Number. - **pmid** (String) - PubMed Identifier. - **pmcid** (String) - PubMed Central Identifier. - **arxiv** (String) - ArXiv identifier. ## POST /entry/identifiers ### Description Sets standard bibliographic identifiers for the entry. ### Parameters #### Request Body - **doi** (String) - Optional - Set the DOI field. - **isbn** (String) - Optional - Set the ISBN field. - **issn** (String) - Optional - Set the ISSN field. - **pmid** (String) - Optional - Set the PMID field. - **pmcid** (String) - Optional - Set the PMCID field. - **arxiv** (String) - Optional - Set the ArXiv field. ``` -------------------------------- ### TryInto Conversion Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Publisher.html Demonstrates the `try_into` method for performing fallible conversions between types. ```APIDOC ## fn try_into(self) -> Result>::Error> ### Description Performs the conversion from type T to type U, returning a Result. ### Method `try_into` ### Parameters None ### Request Body None ### Response #### Success Response (Ok(U)) - **U** (type) - The successfully converted value. #### Error Response (Err(>::Error)) - **Error** (type) - The error encountered during conversion. ``` -------------------------------- ### Get Name with Family Name First Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Returns the full name with the family name first, followed by initials if requested, separated by a comma. ```rust pub fn name_first(&self, initials: bool, prefix_given_name: bool) -> String ``` -------------------------------- ### Trait Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.QualifiedUrl.html Documentation for conversion and serialization traits implemented in the project. ```APIDOC ## Trait Implementations ### TryFrom - **fn try_from(value: U) -> Result>::Error>** - Performs the conversion from type U to T. ### TryInto - **type Error = >::Error** - The type returned in the event of a conversion error. - **fn try_into(self) -> Result>::Error>** - Performs the conversion from type T to U. ### DeserializeOwned - **impl DeserializeOwned for T** - Implemented for types T where T satisfies the Deserialize trait for all lifetimes 'de. ### ErasedDestructor - **impl ErasedDestructor for T** - Implemented for types T where T has a 'static lifetime. ``` -------------------------------- ### PartialEq for Entry Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Entry.html Provides methods for comparing Entry instances for equality. ```APIDOC ## fn eq(&self, other: &Entry) -> bool ### Description Tests for `self` and `other` values to be equal, and is used by `==`. ### Method `eq` ``` ```APIDOC ## fn ne(&self, other: &Rhs) -> bool ### Description Tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. ### Method `ne` ``` -------------------------------- ### Get Typed Value from MaybeTyped Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.MaybeTyped.html Retrieves the strictly typed value from a MaybeTyped enum if it exists. Returns None if the enum holds a String. ```rust pub fn as_typed(&self) -> Option<&T> ``` -------------------------------- ### Retrieve ArchivedStyle by CSL ID Source: https://docs.rs/hayagriva/0.9.1/hayagriva/archive/enum.ArchivedStyle.html Use this function to get a specific citation style by its CSL (Citation Style Language) ID. Returns `None` if the style is not found. ```rust pub fn by_id(id: &str) -> Option ``` -------------------------------- ### Retrieve Prefix String Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Numeric.html Returns the prefix string slice if it exists. ```rust pub fn prefix_str(&self) -> Option<&str> ``` -------------------------------- ### Implement CloneToUninit for T Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.FoldableKind.html Nightly-only experimental API for cloning data into uninitialized memory. Requires the type T to implement Clone. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) { // ... } ``` -------------------------------- ### Implement Hash for Formatting Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatting.html Allows Formatting instances to be used in hash-based collections like HashMaps. It defines how the struct's data is fed into a hasher. ```rust fn hash<__H: Hasher>(&self, state: &mut __H) ``` ```rust fn hash_slice(data: &[Self], state: &mut H) where H: Hasher, Self: Sized, ``` -------------------------------- ### Conversion and Ownership Traits Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.StringChunk.html Documentation for standard library traits providing conversion, cloning, and string representation capabilities. ```APIDOC ## Trait: From ### Description Provides a mechanism for converting a type into another type. ### Method fn from(t: T) -> T ### Description Returns the argument unchanged. --- ## Trait: Into ### Description Provides a mechanism for converting a type into another type, where U implements From. ### Method fn into(self) -> U ### Description Calls U::from(self). --- ## Trait: ToOwned ### Description Defines how to create owned data from borrowed data. ### Methods - **to_owned(&self) -> T**: Creates owned data from borrowed data, usually by cloning. - **clone_into(&self, target: &mut T)**: Uses borrowed data to replace owned data. --- ## Trait: ToString ### Description Converts a value to a String. ### Method fn to_string(&self) -> String --- ## Trait: TryFrom / TryInto ### Description Provides fallible conversion between types. ### Methods - **try_from(value: U) -> Result**: Performs the conversion. - **try_into(self) -> Result**: Performs the conversion. ``` -------------------------------- ### Date Struct Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Date.html Provides methods for creating, displaying, and comparing Date objects. ```APIDOC ## Implementations for Date ### impl Date #### pub fn from_year(year: i32) -> Self Get a date from an integer. #### pub fn display_year(&self) -> String Returns the year as a human-readable gregorian year. Non-positive values will be marked with a “BCE” postfix. #### pub fn display_year_opt( &self, secular: bool, periods: bool, designate_positive: bool, ad_prefix: bool, ) -> String Returns the year as a human-readable gregorian year with controllable pre- and postfixes denominating the year’s positivity. ##### Arguments - **secular** (bool) - Switches between “BC” and “BCE” - **periods** (bool) - Determines whether to use punctuation in the abbreviations - **designate_positive** (bool) - Show a denomination for positive years - **ad_prefix** (bool) - Use the “AD” designation for positive years in a prefix position. Will be ignored if `designate_positive` is negative. ``` -------------------------------- ### Implement Copy for Formatting Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatting.html Indicates that the Formatting struct can be copied by simply copying its bits. This is efficient for small, simple data structures. ```rust impl Copy for Formatting ``` -------------------------------- ### Implement StructuralPartialEq for Formatting Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatting.html Enables structural equality comparison for the Formatting struct, comparing fields directly. ```rust impl StructuralPartialEq for Formatting ``` -------------------------------- ### TryInto Trait Implementation Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.ElemChildren.html Demonstrates the `try_into` method, which is part of the `TryInto` trait, allowing for fallible conversions. ```APIDOC ## fn try_into(self) -> Result>::Error> ### Description Performs the conversion from type `T` to type `U`. ### Method `try_into` (associated function of `TryInto` trait) ### Parameters - `self` (T): The value to convert. ### Returns - `Result>::Error>`: Ok(U) if the conversion is successful, Err(E) otherwise, where E is the error type associated with `TryFrom`. ### Request Example ```rust let value: i32 = 5; let converted_value: Result = value.try_into(); ``` ### Response #### Success Response (Ok) - `U`: The successfully converted value. #### Response Example ```json { "example": "5" } ``` #### Error Response (Err) - `>::Error`: The error encountered during conversion. ``` -------------------------------- ### TryInto Trait Implementation Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.NumericDelimiter.html Documentation for the TryInto trait implementation which allows for fallible conversions between types. ```APIDOC ## impl TryInto for T ### Description Provides a fallible conversion from type T to type U, where U implements TryFrom. ### Associated Types - **Error** (>::Error) - The type returned in the event of a conversion error. ### Methods #### fn try_into(self) -> Result>::Error> Performs the conversion from T to U. ``` -------------------------------- ### TryInto Trait Implementation Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.Selector.html Documentation for the TryInto trait implementation which provides a conversion method for types that implement TryFrom. ```APIDOC ## impl TryInto for T ### Description Provides a conversion from type T to type U, where U implements TryFrom. ### Associated Types - **Error** (>::Error) - The type returned in the event of a conversion error. ### Methods #### fn try_into(self) -> Result>::Error> Performs the conversion from T to U. ``` -------------------------------- ### Implement PartialEq for Elem Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Elem.html Defines equality comparison for Elem instances. ```rust fn eq(&self, other: &Elem) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Implement Default for Formatting Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatting.html Provides a default value for the Formatting struct. Use this when you need a standard set of formatting properties. ```rust fn default() -> Formatting ``` -------------------------------- ### Implement PartialEq for PersonRole Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.PersonRole.html Tests for equality between two PersonRole values. ```rust fn eq(&self, other: &PersonRole) -> bool ``` -------------------------------- ### Owned Data Creation and Cloning Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Library.html This section details methods for creating owned data from borrowed data and for cloning data into existing mutable references. ```APIDOC ## fn to_owned(&self) -> T ### Description Creates owned data from borrowed data, usually by cloning. ### Method N/A (associated function within an impl block) ### Endpoint N/A ## fn clone_into(&self, target: &mut T) ### Description Uses borrowed data to replace owned data, usually by cloning. ### Method N/A (associated function within an impl block) ### Endpoint N/A ``` -------------------------------- ### PartialEq Implementation for Formatted Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatted.html Defines equality comparison for the Formatted struct. The `eq` method tests for equality, while `ne` tests for inequality. ```rust fn eq(&self, other: &Formatted) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### TryFrom and TryInto Trait Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.ElemChild.html Documentation for the conversion traits used for fallible type transformations. ```APIDOC ## TryFrom ### Description Performs the conversion from type U to T. ### Method fn try_from(value: U) -> Result>::Error> ## TryInto ### Description Performs the conversion from type T to U. ### Method fn try_into(self) -> Result>::Error> ### Associated Types - **Error** - The type returned in the event of a conversion error. ``` -------------------------------- ### Implement Clone for BibliographyItem Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.BibliographyItem.html Provides the ability to create a duplicate of a BibliographyItem. This is useful for scenarios where you need to work with multiple copies of the same bibliography entry. ```rust fn clone(&self) -> BibliographyItem ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### EntryType Trait Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.EntryType.html Details regarding the core trait implementations for EntryType including hashing, equality, and serialization. ```APIDOC ## Hashing ### Method fn hash_slice(data: &[Self], state: &mut H) where H: Hasher, Self: Sized ### Description Feeds a slice of this type into the given Hasher. ## Equality ### Method fn eq(&self, other: &EntryType) -> bool ### Description Tests for self and other values to be equal, and is used by ==. ### Method fn ne(&self, other: &Rhs) -> bool ### Description Tests for !=. ## Serialization ### Method fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer ### Description Serialize this value into the given Serde serializer. ``` -------------------------------- ### Clone Implementation for RenderedBibliography Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.RenderedBibliography.html Provides methods for cloning RenderedBibliography instances. ```APIDOC ### impl Clone for RenderedBibliography #### fn clone(&self) -> RenderedBibliography Returns a duplicate of the value. #### fn clone_from(&mut self, source: &Self) Performs copy-assignment from `source`. ``` -------------------------------- ### Auto Trait Implementations for Entry Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Entry.html Details the automatic trait implementations for the Entry struct. ```APIDOC ## impl Freeze for Entry ### Description Indicates that Entry implements the `Freeze` trait. ``` ```APIDOC ## impl RefUnwindSafe for Entry ### Description Indicates that Entry implements the `RefUnwindSafe` trait. ``` ```APIDOC ## impl Send for Entry ### Description Indicates that Entry implements the `Send` trait. ``` ```APIDOC ## impl Sync for Entry ### Description Indicates that Entry implements the `Sync` trait. ``` ```APIDOC ## impl Unpin for Entry ### Description Indicates that Entry implements the `Unpin` trait. ``` ```APIDOC ## impl UnwindSafe for Entry ### Description Indicates that Entry implements the `UnwindSafe` trait. ``` -------------------------------- ### Implement Equivalent for Q Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.FoldableKind.html Checks for equivalence between two types Q and K, where K can be borrowed as Q. Used for comparisons in collections. ```rust impl Equivalent for Q where Q: Eq + ?Sized, K: Borrow + ?Sized { fn equivalent(&self, key: &K) -> bool { // ... } } ``` -------------------------------- ### Compare FormatString for Equality Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.FormatString.html Implements PartialEq and Eq for FormatString, allowing for equality comparisons. ```rust fn eq(&self, other: &FormatString) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Implement PartialEq for LocatorPayload Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.LocatorPayload.html Allows for equality comparison between LocatorPayload instances. This implementation is used by the equality operators (== and !=). ```rust impl<'a> PartialEq for LocatorPayload<'a> Source§ #### fn eq(&self, other: &LocatorPayload<'a>) -> bool Tests for `self` and `other` values to be equal, and is used by `==`. 1.0.0 · Source§ #### fn ne(&self, other: &Rhs) -> bool Tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason. Source ``` -------------------------------- ### TryInto Conversion API Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.ChunkedStrParseError.html Defines the conversion process and error handling for the TryInto trait. ```APIDOC ## try_into ### Description Performs the conversion from type T to type U. ### Method Function ### Parameters - **self** - Required - The instance to be converted. ### Response - **Result>::Error>** - Returns the converted type U on success, or the associated conversion error. ``` -------------------------------- ### Format String Variants Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.FormatString.html Methods for formatting the FormatString, including its short version or in title/sentence case. ```rust pub fn fmt_short(&self, buf: &mut Formatter<'_>) -> Result ``` ```rust pub fn format_title_case(&self, props: TitleCase) -> String ``` ```rust pub fn format_sentence_case(&self, props: SentenceCase) -> String ``` -------------------------------- ### Clone Implementation for RenderedBibliography Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.RenderedBibliography.html Provides methods to duplicate a RenderedBibliography instance. ```rust fn clone(&self) -> RenderedBibliography ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Implementing FromStr for EntryType Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.EntryType.html Allows parsing EntryType from string representations. This is useful for converting string inputs into the enum. ```rust impl FromStr for EntryType { type Err = Error; fn from_str(s: &str) -> Result } ``` -------------------------------- ### Date Trait Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Date.html Details the trait implementations for the Date struct, including Clone, Debug, Display, From, FromStr, Hash, PartialEq, PartialOrd, and Serialize. ```APIDOC ## Trait Implementations for Date ### impl Clone for Date - `clone(&self) -> Date`: Returns a duplicate of the value. - `clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. ### impl Debug for Date - `fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### impl<'de> Deserialize<'de> for Date - `deserialize(deserializer: D) -> Result` where D: Deserializer<'de>: Deserialize this value from the given Serde deserializer. ### impl Display for Date - `fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. ### impl From for Date - `from(date: Date) -> Self`: Converts to this type from the input type. ### impl FromStr for Date - `from_str(source: &str) -> Result`: Parse a date from a string. - **Err**: `DateError` ### impl Hash for Date - `hash<__H: Hasher>(&self, state: &mut __H)`: Feeds this value into the given `Hasher`. - `hash_slice(data: &[Self], state: &mut H)` where H: Hasher, Self: Sized: Feeds a slice of this type into the given `Hasher`. ### impl PartialEq for Date - `eq(&self, other: &Date) -> bool`: Tests for `self` and `other` values to be equal. - `ne(&self, other: &Rhs) -> bool`: Tests for `!=`. ### impl PartialOrd for Date - `partial_cmp(&self, other: &Self) -> Option`: Returns an ordering between `self` and `other` values if one exists. - `lt(&self, other: &Rhs) -> bool`: Tests less than. - `le(&self, other: &Rhs) -> bool`: Tests less than or equal to. - `gt(&self, other: &Rhs) -> bool`: Tests greater than. - `ge(&self, other: &Rhs) -> bool`: Tests greater than or equal to. ### impl Serialize for Date - `serialize(&self, serializer: S) -> Result` where S: Serializer: Serialize this value into the given Serde serializer. ### impl Copy for Date ### impl Eq for Date ### impl StructuralPartialEq for Date ``` -------------------------------- ### Clone Implementation for Formatted Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatted.html Provides methods for cloning a Formatted struct. The `clone` method creates a duplicate, while `clone_from` performs copy-assignment. ```rust fn clone(&self) -> Formatted ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Blanket Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Entry.html Details blanket trait implementations applicable to Entry. ```APIDOC ## impl Any for T ### Description Provides runtime type information. #### fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method `type_id` ``` ```APIDOC ## impl Borrow for T ### Description Provides immutable access to a borrowed value. #### fn borrow(&self) -> &T ### Description Immutably borrows from an owned value. ### Method `borrow` ``` ```APIDOC ## impl BorrowMut for T ### Description Provides mutable access to a borrowed value. #### fn borrow_mut(&mut self) -> &mut T ### Description Mutably borrows from an owned value. ### Method `borrow_mut` ``` ```APIDOC ## impl CloneToUninit for T ### Description Performs copy-assignment from `self` to a destination in uninitialized memory. This is a nightly-only experimental API. #### unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description Performs copy-assignment from `self` to `dest`. ### Method `clone_to_uninit` ``` ```APIDOC ## impl Equivalent for Q ### Description Checks if a value is equivalent to another, often used in collections for key lookups. #### fn equivalent(&self, key: &K) -> bool ### Description Checks if this value is equivalent to the given key. ### Method `equivalent` ``` ```APIDOC ## impl Equivalent for Q ### Description Compares self to `key` and returns `true` if they are equal. #### fn equivalent(&self, key: &K) -> bool ### Description Compare self to `key` and return `true` if they are equal. ### Method `equivalent` ``` ```APIDOC ## impl From for T ### Description Provides a way to create a value of type `T` from another value of type `T`. #### fn from(t: T) -> T ### Description Returns the argument unchanged. ### Method `from` ``` ```APIDOC ## impl Into for T ### Description Provides a way to convert a value of type `T` into a value of type `U`. #### fn into(self) -> U ### Description Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ### Method `into` ``` ```APIDOC ## impl ToOwned for T ### Description Provides methods for creating an owned version of a borrowed value. #### type Owned = T ### Description The resulting type after obtaining ownership. ### Type `Owned` #### fn to_owned(&self) -> T ### Description Creates owned data from borrowed data, usually by cloning. ### Method `to_owned` #### fn clone_into(&self, target: &mut T) ### Description Uses borrowed data to replace owned data, usually by cloning. ### Method `clone_into` ``` ```APIDOC ## impl TryFrom for T ### Description Provides a fallible way to convert a value of type `U` into a value of type `T`. #### type Error = Infallible ### Description The type returned in the event of a conversion error. ### Type `Error` #### fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion. ### Method `try_from` ``` ```APIDOC ## impl TryInto for T ### Description Provides a fallible way to convert a value of type `T` into a value of type `U`. #### type Error = >::Error ### Description The type returned in the event of a conversion error. ### Type `Error` #### fn try_into(self) -> Result>::Error> ### Description Performs the conversion. ### Method `try_into` ``` ```APIDOC ## impl ErasedDestructor for T ### Description Indicates that Entry implements the `ErasedDestructor` trait. ``` -------------------------------- ### Convert BibLaTeX Entry to Hayagriva Entry Source: https://docs.rs/hayagriva/0.9.1/hayagriva/index.html Demonstrates converting a BibLaTeX entry to Hayagriva's native Entry struct. This requires the `biblatex` crate as a dependency. ```rust use hayagriva::Entry; let converted: Entry = your_biblatex_entry.into(); ``` -------------------------------- ### TryFrom Trait Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.DurationError.html Documentation for the TryFrom trait used for fallible conversions. ```APIDOC ## TryFrom Trait ### Description Defines a fallible conversion from a type U to a type T. ### Associated Types - **Error** (Infallible) - The type returned in the event of a conversion error. ### Methods - **try_from(value: U) -> Result>::Error>** - Performs the conversion. ``` -------------------------------- ### Implement From for T Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/enum.FoldableKind.html A trivial implementation of From for T, which simply returns the input value unchanged. Useful in generic contexts. ```rust impl From for T { fn from(t: T) -> T { // ... } } ``` -------------------------------- ### Create Person from String Parts Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.Person.html Constructs a Person instance from a vector of string slices. Expects one to three parts representing prefix, name, given name, and suffix. ```rust pub fn from_strings(parts: Vec<&str>) -> Result ``` -------------------------------- ### Implement Any for T Source: https://docs.rs/hayagriva/0.9.1/hayagriva/enum.LocatorPayload.html Provides runtime type information for any type T. This is a blanket implementation, meaning it applies to all types that satisfy the 'static bound. ```rust impl Any for T where T: 'static + ?Sized, Source§ #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more Source ``` -------------------------------- ### Create New TransparentLocator Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.TransparentLocator.html Creates a new TransparentLocator instance that wraps a given payload. The payload must implement PartialEq and have a static lifetime. ```rust pub fn new(payload: T) -> Self ``` -------------------------------- ### Generic Blanket Implementations Source: https://docs.rs/hayagriva/0.9.1/hayagriva/struct.Formatted.html Showcases various generic blanket implementations available for types like Formatted, including Any, Borrow, BorrowMut, CloneToUninit, Equivalent, From, Into, ToOwned, TryFrom, and TryInto. ```rust impl Any for T where T: 'static + ?Sized, ``` ```rust fn type_id(&self) -> TypeId ``` ```rust impl Borrow for T where T: ?Sized, ``` ```rust fn borrow(&self) -> &T ``` ```rust impl BorrowMut for T where T: ?Sized, ``` ```rust fn borrow_mut(&mut self) -> &mut T ``` ```rust impl CloneToUninit for T where T: Clone, ``` ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` ```rust impl Equivalent for Q where Q: Eq + ?Sized, K: Borrow + ?Sized, ``` ```rust fn equivalent(&self, key: &K) -> bool ``` ```rust impl From for T ``` ```rust fn from(t: T) -> T ``` ```rust impl Into for T where U: From, ``` ```rust fn into(self) -> U ``` ```rust impl ToOwned for T where T: Clone, ``` ```rust type Owned = T ``` ```rust fn to_owned(&self) -> T ``` ```rust fn clone_into(&self, target: &mut T) ``` ```rust impl TryFrom for T where U: Into, ``` ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` ```rust impl TryInto for T where U: TryFrom, ``` ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` ```rust impl ErasedDestructor for T where T: 'static, ``` -------------------------------- ### Create New FormatString Source: https://docs.rs/hayagriva/0.9.1/hayagriva/types/struct.FormatString.html Provides methods to create new FormatString instances, either empty, with a single value, or with both a long and short value. ```rust pub fn new() -> Self ``` ```rust pub fn with_value(value: impl Into) -> Self ``` ```rust pub fn with_short(value: impl Into, short: impl Into) -> Self ```