Added some basic examples in the README

master
Wynd 2024-04-21 16:22:28 +03:00
parent 96d8868bf7
commit 25863f9e46
4 changed files with 22 additions and 3 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
*.backup

View File

@ -1,3 +1,21 @@
# playerdb-rs
[playerdb](https://playerdb.co/) client with support for async/sync.
[playerdb](https://playerdb.co/) client with support for async/sync.
## Examples
### Async (using Tokio)
```Rust
let api = playerdb_rs::PlayerDBApi::default();
let result = api.get_minecraft_player("notch").await;
dbg!(result);
```
### Sync
```Rust
let api = playerdb_rs::sync::PlayerDBApi::default();
let result = api.get_minecraft_player("notch");
dbg!(result);
```

View File

@ -4,7 +4,7 @@ use playerdb_rs::PlayerDBApi;
async fn main() -> anyhow::Result<()> {
let api = PlayerDBApi::default();
let res = api.get_minecraft_player("wyndftw").await?;
let res = api.get_minecraft_player("notch").await?;
print!("{:#?}", res);

View File

@ -3,7 +3,7 @@ use playerdb_rs::sync::PlayerDBApi;
fn main() {
let api = PlayerDBApi::default();
let res = api.get_minecraft_player("wyndftw");
let res = api.get_minecraft_player("notch");
match res {
Ok(x) => println!("{:#?}", x),