rspaste
A simple, fast and fully-typed JSPaste API wrapper for Rust.
aidak.tk »
Installation
Put the desired version of the crate into the dependencies
section of your Cargo.toml
:
[dependencies]
rspaste = "*"
Examples
First of all, JSPaste API can return errors if a key or secret is invalid, so a good way of handling responses is:
match some_doc {
Ok(d) => todo!(), // ...
Err(e) => todo!() // ...
}
We recommend doing this with every request to ensure that all cases are covered.
use rspaste;
fn main() {
let doc = rspaste::api::get("key"); // get document
let posted_doc = rspaste::api::post("content"); // post document
let deleted_doc = rspaste::api::delete("key", "secret"); // delete document
}