Skip to content

Commit

Permalink
Update README.md.
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin P. Jung <headcr4sh@gmail.com>
  • Loading branch information
headcr4sh committed Aug 29, 2024
1 parent 6628f11 commit e3de0ba
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# Gravatar API Client for Rust

A small library to access the Gravatar API,
inspired by [rust-gravatar](https://github.com/chowdhurya/rust-gravatar/).

## Example Usage

```rust
extern crate gravatar_api;
use gravatar_api::avatars;

fn main() {
println!(
"{}",
avatars::Avatar::builder("john.doe@example.com")
.size(512)
.default(avatars::Default::RoboHash)
.rating(avatars::Rating::G)
.build()
.image_url()
);
}
``
let url = avatars::Avatar::builder("john.doe@example.com")
.size(512)
.default(avatars::Default::RoboHash)
.rating(avatars::Rating::G)
.build()
.image_url();
assert_eq!(
url.as_str(),
"https://www.gravatar.com/avatar/836f82db99121b3481011f16b49dfa5fbc714a0d1b1b9f784a1ebbbf5b39577f?s=512&r=g&d=robohash"
);
```

0 comments on commit e3de0ba

Please sign in to comment.