6 releases

0.1.5 Jan 9, 2024
0.1.4 Jan 9, 2024
0.1.3 Jun 19, 2023
0.1.2 May 20, 2023
0.1.0 May 17, 2022

#316 in Programming languages

28 downloads per month

Apache-2.0

9KB
83 lines

A minimal, blazing-fast and fully-typed JSPaste API library for Rust


Crates.io Version GitHub License

Features

  • Simple. Perform requests to JSPaste out of the box with simple functions.
  • Robust. RSPaste is built in Rust, the world's most loved programming language.
  • Safe. RSPaste is completely typesafe, meaning that all data received from the API is typed correctly.

Install

Put the desired version of the crate into the dependencies section of your Cargo.toml:

[dependencies]
rspaste = { version = "0.1.5" }

Example

First of all, the JSPaste API may return errors if something goes wrong, so using pattern matching is a good idea:

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 created_doc = rspaste::api::post("content"); // post document
    let deleted_doc = rspaste::api::delete("key", "secret"); // delete document
}

Dependencies

~4–6MB
~103K SLoC