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.

Re-exports§

pub use crate::error::Error;

Modules§

client
Configure the HTTP client global state
config
Configure the HTTP client global state
entity
All Musicbrainz entities
error
Crate errors;
prelude
Brings trait and type needed to perform any API query in scope
query
The structures to create queries

Structs§

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

Traits§

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