pub struct Contributor { /* private fields */ }Expand description
Somebody who had a hand in a work: music21’s metadata.Contributor. A
composer, a lyricist, an arranger, or anybody else, under one or more
names.
use music21::metadata::primitives::{Contributor, Text};
let composer = Contributor::new("composer", [Text::new("Beethoven, Ludwig van")]);
assert_eq!(composer.role(), Some("composer"));
assert_eq!(composer.to_string(), "composer:Beethoven, Ludwig van");Implementations§
Source§impl Contributor
impl Contributor
Sourcepub fn role_of_abbreviation(abbreviation: &str) -> Result<&'static str>
pub fn role_of_abbreviation(abbreviation: &str) -> Result<&'static str>
The role an abbreviation stands for, read without regard to case:
music21’s abbreviationToRole.
§Errors
An abbreviation no role is written with.
Sourcepub fn abbreviation_of_role(role: &str) -> Result<&'static str>
pub fn abbreviation_of_role(role: &str) -> Result<&'static str>
The abbreviation a role is written with, read without regard to
case: music21’s roleToAbbreviation.
§Errors
A role no abbreviation is written for.
Sourcepub fn new<I, T>(role: impl Into<String>, names: I) -> Self
pub fn new<I, T>(role: impl Into<String>, names: I) -> Self
Somebody in a role, under these names. An abbreviation is read as the role it stands for.
Sourcepub fn unnamed() -> Self
pub fn unnamed() -> Self
Somebody in no role at all, which is what music21 starts a contributor out as.
Sourcepub fn names(&self) -> &[Text]
pub fn names(&self) -> &[Text]
Every name they go by, the first being the one music21 answers for
name.
Sourcepub fn birth(&self) -> Option<&DatePrimitive>
pub fn birth(&self) -> Option<&DatePrimitive>
When they were born, where it is known.
Sourcepub fn death(&self) -> Option<&DatePrimitive>
pub fn death(&self) -> Option<&DatePrimitive>
When they died, where it is known.
Sourcepub fn set_role(&mut self, role: Option<String>)
pub fn set_role(&mut self, role: Option<String>)
Says what they did. An abbreviation is read as the role it stands
for, as music21’s own setter reads one, so a contributor given
com is a composer.
Sourcepub fn set_name(&mut self, name: Text)
pub fn set_name(&mut self, name: Text)
Gives them one name, in place of any they had: music21’s name
setter, which replaces the whole list.
Sourcepub fn set_birth(&mut self, birth: Option<DatePrimitive>)
pub fn set_birth(&mut self, birth: Option<DatePrimitive>)
Says when they were born.
Sourcepub fn set_death(&mut self, death: Option<DatePrimitive>)
pub fn set_death(&mut self, death: Option<DatePrimitive>)
Says when they died.
Trait Implementations§
Source§impl Clone for Contributor
impl Clone for Contributor
Source§impl Debug for Contributor
impl Debug for Contributor
Source§impl Default for Contributor
impl Default for Contributor
Source§impl<'de> Deserialize<'de> for Contributor
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Contributor
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Contributor
Written as music21’s _reprInternal writes one: the role, a colon, and
every name they go by.
impl Display for Contributor
Written as music21’s _reprInternal writes one: the role, a colon, and
every name they go by.
impl Eq for Contributor
Source§impl Hash for Contributor
impl Hash for Contributor
Source§impl PartialEq for Contributor
impl PartialEq for Contributor
Source§impl Serialize for Contributor
Available on crate feature serde only.
impl Serialize for Contributor
serde only.impl StructuralPartialEq for Contributor
Auto Trait Implementations§
impl Forget for Contributor
impl Freeze for Contributor
impl RefUnwindSafe for Contributor
impl Send for Contributor
impl Sync for Contributor
impl Unpin for Contributor
impl UnsafeUnpin for Contributor
impl UnwindSafe for Contributor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more