Struct Membership

Source
pub struct Membership {
    pub relation_id: Option<String>,
    pub role_id: Option<String>,
    pub direction: Option<String>,
    pub mbid: String,
    pub name: String,
    pub credited_as: Option<String>,
    pub side: Side,
    pub kind: String,
    pub attributes: Vec<String>,
    pub began: Option<String>,
    pub ended: Option<String>,
    pub over: Option<bool>,
}
Expand description

One spell in a band, as a source dates it.

A person can appear twice, and the second row is not a duplicate: Ozzy Osbourne was in Black Sabbath from 1968 to 1979 and again from 1997, and a list that folded the two into one span would claim he was there in 1985. MusicBrainz states them as two relations and they are kept as two rows.

Fields§

§relation_id: Option<String>

MusicBrainz relationship row identifier, when exposed.

§role_id: Option<String>

Stable MusicBrainz relationship type identifier.

§direction: Option<String>

Direction exactly as returned by MusicBrainz.

§mbid: String

The other artist’s MusicBrainz identifier, which is what makes a later fetch about them an update rather than a second opinion.

§name: String

The other artist’s name, as the source spells it.

§credited_as: Option<String>

Exact spelling used for the related artist in this relationship.

§side: Side

Which end of the relation that name is — see Side.

§kind: String

How the source names the relationship, in its own words: member of band, instrumental supporting musician.

Kept verbatim and shown verbatim, the same rule KnownRelease::stated_type follows. The two are not the same fact — a founding member and a guitarist hired for one tour are both on a record and only one of them was in the band — and paraphrasing them into one word would throw away the distinction MusicBrainz took the trouble to draw.

§attributes: Vec<String>

What the source lists against the relationship.

Not “instruments”, although most of them are. Measured on a real answer: Judas Priest’s line-up carries ["guitar family", "original"] on one row, where original marks an original member and is not an instrument at all. Calling this field instruments would put a lie in a column header, so it carries the source’s own word and its own values.

§began: Option<String>

When it started: a year, or a fuller date when the source has one.

§ended: Option<String>

When it stopped.

§over: Option<bool>

Whether the source says it is over.

The same distinction ArtistFacts::active draws, and it matters more here: a membership with no end date may be a current one or one nobody has filled in, and printing “1968–” for both tells the reader something the source never said. Some(false) is “still in the band”.

Implementations§

Source§

impl Membership

Source

pub fn covers(&self, year: u32) -> Option<bool>

Whether this membership was running in a given year: Some(true), Some(false), or None where the source’s dates cannot say.

The three-way answer is the point. A membership with no start date places nobody, and one the source says has ended without saying when places nobody either — the end is somewhere, and “somewhere” cannot be compared with a year. Both come back None, so a caller has to decide what to do about them rather than being handed a false that looks like knowledge.

Source

pub fn years(&self) -> String

The years as a reader recognises them: 1968–1979, 1968– for a current member, 1968 where the source only knows a start and does not say whether it ended.

Never invents an end. A dash trailing into nothing is a claim that the membership is still going, and it is one MusicBrainz makes with ended: false rather than with a missing date.

Trait Implementations§

Source§

impl Clone for Membership

Source§

fn clone(&self) -> Membership

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 Membership

Source§

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

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

impl PartialEq for Membership

Source§

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

Source§

impl StructuralPartialEq for Membership

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

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
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,