Crate musicbrainz_rs

source ·
Expand description

MusicBrainz rust is a utility crate for the the MusicBrainz API. It strives to provide a simple and easy to use API to query the Musicbrainz database.

All query are performed via a builder pattern fashioned syntax on musicbrainz entities available in the entity module.

Example

The most simple usage would be to lookup an entity, knowing its Musicbrainz ID.

use musicbrainz_rs::entity::artist::Artist;
use musicbrainz_rs::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Error> {

   let nirvana = Artist::fetch()
       .id("5b11f4ce-a62d-471e-81fc-a69a8278c7da")
       .execute()
        .await;

   assert_eq!(nirvana?.name, "Nirvana".to_string());
   Ok(())
}
fn main() -> Result<(), Error> {

   let nirvana = Artist::fetch()
       .id("5b11f4ce-a62d-471e-81fc-a69a8278c7da")
       .execute();

   assert_eq!(nirvana?.name, "Nirvana".to_string());
   Ok(())
}

Note that you need to either directly to bring the Fetch trait in scope or use the prelude module to make the fetch method accessible.

Modules

Configure the HTTP client global state
All Musicbrainz entities
Brings trait and type needed to perform any API query in scope

Structs

Direct lookup of all the entities directly linked to another entity
perform a lookup of an entity when you have the MBID for that entity
Search requests provide a way to search for MusicBrainz entities based on different sorts of queries.

Traits

Implemented by all browsable entities (see BrowseQuery)
Implemented by all fetchable entities (see FetchQuery)
Implemented by all fetchable coverart entities (see FetchCoverartQuery)
Provide the entity HTTP api path, do not use this trait directly
Implemented by all searchable entities (see SearchQuery)

Type Definitions

Type alias for reqwest::Error