Author

Struct Author 

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

Represents a single author as (typically) described on the author line.

The attributes firstname, middlename, lastname, and authorinitials are automatically derived from the full value of the author string. When assigned implicitly via the author line, the value includes all of the characters and words prior to the semicolon (;), angle bracket (<), or the end of the line. Note that when using the implicit author line, the full name can have a maximum of three space-separated names. If it has more, then the full name is assigned to the firstname attribute. You can adjoin names using an underscore (_) character.

Implementations§

Source§

impl Author

Source

pub fn name(&self) -> &str

Returns the full name of the author.

The name includes the entire author declaration except for email.

Source

pub fn firstname(&self) -> &str

Returns the first, forename, or given name of the author.

The first space-separated name in the value of the author attribute is automatically assigned to firstname.

Source

pub fn middlename(&self) -> Option<&str>

Returns the middle name or initial of the author.

If author contains three space-separated names, the second name is assigned to the middlename attribute.

Source

pub fn lastname(&self) -> Option<&str>

Returns the last, surname, or family name of the author.

If the author name contains two or three space-separated names, the last of those names is assigned to the lastname attribute.

Source

pub fn email(&self) -> Option<&str>

Returns the email address or URL associated with the author.

When assigned via the author line, it’s enclosed in a pair of angle brackets (< >). A URL can be used in place of the email address.

Source

pub fn initials(&self) -> String

Returns the initials of the author.

The first character of the firstname, middlename, and lastname attribute values are assigned to the authorinitials attribute. The value of the authorinitials attribute will consist of three characters or less depending on how many parts are in the author’s name.

Trait Implementations§

Source§

impl Clone for Author

Source§

fn clone(&self) -> Author

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Author

Source§

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

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

impl PartialEq for Author

Source§

fn eq(&self, other: &Author) -> 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§

impl Eq for Author

Source§

impl StructuralPartialEq for Author

Auto Trait Implementations§

§

impl Freeze for Author

§

impl RefUnwindSafe for Author

§

impl Send for Author

§

impl Sync for Author

§

impl Unpin for Author

§

impl UnwindSafe for Author

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> 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> 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.