Added some basic examples in the README
parent
96d8868bf7
commit
25863f9e46
|
@ -13,3 +13,4 @@ Cargo.lock
|
|||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
*.backup
|
20
README.md
20
README.md
|
@ -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);
|
||||
```
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue