0.4.0
What's Changed
- Allows proper chaining of methods
- simplify types by internally storing
username
andapi_key
as Strings and only acceptAsRef<str>
in the constructors - have
from_env
andtry_from_env
methods also inClientBuilder()
Breaking changes
The ClientBuilder
now allows for proper chaining of methods:
use lastfm::ClientBuilder;
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_key = env::var("LASTFM_API_KEY")?;
- let mut client_builder = ClientBuilder::new(api_key, "loige".to_string());
- client_builder.reqwest_client(reqwest::Client::new());
- client_builder.base_url("http://localhost:8080".parse().unwrap());
- let client = client_builder.build();
+ let client = ClientBuilder::new(api_key, "loige")
+ .reqwest_client(reqwest::Client::new())
+ .base_url("http://localhost:8080".parse().unwrap())
+ .build();
// do something with client...
Ok(())
}
Full Changelog: 0.3.0...0.4.0