This commit is contained in:
Alex 2022-04-21 23:03:49 +02:00
parent d169cb71dd
commit 027d9a8dbe
2 changed files with 26 additions and 17 deletions

View file

@ -16,4 +16,27 @@ chrono = { version = "0.4.19", features = ["serde"] }
futures = { version = "0.3.21" } futures = { version = "0.3.21" }
rand = { version = "0.8.5" } rand = { version = "0.8.5" }
reqwest = { version = "0.11.10", features = ["json"] } reqwest = { version = "0.11.10", features = ["json"] }
serde = { version = "1.0.136", features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] }
[badges]
# The `maintenance` table indicates the status of the maintenance of
# the crate. This may be used by a registry, but is currently not
# used by crates.io. See https://github.com/rust-lang/crates.io/issues/2437
# and https://github.com/rust-lang/crates.io/issues/2438 for more details.
#
# The `status` field is required. Available options are:
# - `actively-developed`: New features are being added and bugs are being fixed.
# - `passively-maintained`: There are no plans for new features, but the maintainer intends to
# respond to issues that get filed.
# - `as-is`: The crate is feature complete, the maintainer does not intend to continue working on
# it or providing support, but it works for the purposes it was designed for.
# - `experimental`: The author wants to share it with the community but is not intending to meet
# anyone's particular use case.
# - `looking-for-maintainer`: The current maintainer would like to transfer the crate to someone
# else.
# - `deprecated`: The maintainer does not recommend using this crate (the description of the crate
# can describe why, there could be a better solution available or there could be problems with
# the crate that the author does not want to fix).
# - `none`: Displays no badge on crates.io, since the maintainer has not chosen to specify
# their intentions, potential crate users will need to investigate on their own.
maintenance = { status = "actively-developed" }

View file

@ -8,7 +8,6 @@ radiobrowser = "*"
``` ```
Example: Example:
```rust ```rust
use futures::join;
use radiobrowser::RadioBrowserAPI; use radiobrowser::RadioBrowserAPI;
use radiobrowser::StationOrder; use radiobrowser::StationOrder;
use std::error::Error; use std::error::Error;
@ -16,32 +15,19 @@ use std::error::Error;
#[async_std::main] #[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> { async fn main() -> Result<(), Box<dyn Error>> {
let mut api = RadioBrowserAPI::new().await?; let mut api = RadioBrowserAPI::new().await?;
let countries = api.get_countries().send();
let languages = api.get_languages().send();
let tags = api.get_tags().filter("jazz").send();
let stations = api let stations = api
.get_stations() .get_stations()
.name("jazz") .name("jazz")
.reverse(true) .reverse(true)
.order(StationOrder::Clickcount) .order(StationOrder::Clickcount)
.send(); .send()
let config = api.get_server_config(); .await?;
let (stations, config, countries, languages, tags) = join!(stations, config, countries, languages, tags);
println!("Config: {:#?}", config?);
println!("Countries found: {}", countries?.len());
println!("Languages found: {}", languages?.len());
let tags = tags?;
println!("Tags found: {}", tags.len());
println!("{:?}", tags);
println!("Stations found: {}", stations?.len()); println!("Stations found: {}", stations?.len());
Ok(()) Ok(())
} }
``` ```
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage ## Usage
Documentation is at https://docs.rs/radiobrowser Documentation is at https://docs.rs/radiobrowser