Jplaceholder
A Rust library for the JSON Placeholder API
Table of Contents
Example:
extern crate jplaceholder;
use Model;
use Post;
match find
Installation
To install the library, you just have to put it into your Cargo.toml file:
= "0.1.0"
Then, require the library into your main file.
extern crate jplaceholder;
Usage
The model trait
The model trait provides usefull methods to interact with the resources.
fn find(id: i32) -> Option;
Finds a resource by its ID
Example:
use Model;
use Post;
match find
fn all(id: i32) -> Option;
Gets all of the resources
Example:
use Model;
use Post;
let posts: = all;
for post in posts
fn create() -> Vec;
Creates a new resource
Example:
use Model;
use Post;
let post = Post;
println!
Contribution guide
- Fork and Clone the repository
- Create your own branch
- Start Coding!
- Make a pull request when you're done :)