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
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
*.pdb
|
*.pdb
|
||||||
|
*.backup
|
18
README.md
18
README.md
|
@ -1,3 +1,21 @@
|
||||||
# playerdb-rs
|
# 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<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
let api = PlayerDBApi::default();
|
let api = PlayerDBApi::default();
|
||||||
|
|
||||||
let res = api.get_minecraft_player("wyndftw").await?;
|
let res = api.get_minecraft_player("notch").await?;
|
||||||
|
|
||||||
print!("{:#?}", res);
|
print!("{:#?}", res);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ use playerdb_rs::sync::PlayerDBApi;
|
||||||
fn main() {
|
fn main() {
|
||||||
let api = PlayerDBApi::default();
|
let api = PlayerDBApi::default();
|
||||||
|
|
||||||
let res = api.get_minecraft_player("wyndftw");
|
let res = api.get_minecraft_player("notch");
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
Ok(x) => println!("{:#?}", x),
|
Ok(x) => println!("{:#?}", x),
|
||||||
|
|
Loading…
Reference in New Issue