[][src]Crate rustnao

RustNAO

A Rust implementation of a wrapper for the SauceNAO API.

Installation

Examples

Here's a simple example:

extern crate rustnao;
use rustnao::{Handler, Sauce};
 
fn main() {
	let api_key = "your_api_key";
	let file = "https://i.imgur.com/W42kkKS.jpg";
 
	// Specifying our key, only want to see Pixiv and Sankaku using a mask, and 15 results at most
	let mut handle = Handler::new(api_key, None, Some([Handler::PIXIV, Handler::SANKAKU_CHANNEL].to_vec()), None, None, Some(15));
 
    // Set the minimum similiarity to 45.
	handle.set_min_similarity(45);
 
	// Returns a vector of Sauce objects if successful
	let result : Vec<Sauce> = handle.get_sauce(file).unwrap();
 
	// Or perhaps you prefer a JSON output
	let result_json : String = handle.get_sauce_as_pretty_json(file).unwrap();
}

Structs

Error

An error that can occur while interacting to the SauceNAO API.

Handler

A handler struct to make SauceNAO API calls.

Sauce

A Sauce struct contains one result from a API call made by the Handler.

Enums

ErrType

The specific type of error that can occur.

Type Definitions

Result

A type alias for handling errors related to rustnao.