Skip to content

Commit

Permalink
Update tinify doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Danieroner committed Jun 20, 2021
1 parent f6b4863 commit 14e7808
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/tinify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ lazy_static! {
/// ```
/// use tinify_rs::tinify;
///
/// let key = "tinify api key";
/// tinify::set_key(key);
/// fn main() {
/// let key = "tinify api key";
/// tinify::set_key(key);
/// }
/// ```
pub fn set_key(new_key: &str) {
let key = new_key.to_string();
Expand All @@ -45,6 +47,8 @@ pub fn get_client() -> Client {
/// use tinify_rs::tinify;
///
/// fn main() {
/// tinify::set_key("tinify api key");
///
/// let source = tinify::from_file("./unoptimized.png");
/// let compress = source.to_file("./optimized.png");
/// }
Expand All @@ -65,6 +69,8 @@ pub fn from_file(path: &str) -> Source {
/// use std::fs;
///
/// fn main() {
/// tinify::set_key("tinify api key");
///
/// let bytes = fs::read("./unoptimized.png").unwrap();
/// let buffer = tinify::from_buffer(&bytes).to_buffer();
/// let save = fs::write("./optimized.png", buffer);
Expand Down

0 comments on commit 14e7808

Please sign in to comment.