[−][src]Struct rustnao::Sauce
A Sauce struct contains one result from a API call made by the Handler.
Example
use rustnao::{Sauce, Handler}; let mut handle = Handler::new("your_saucenao_api_key", Some(0), None, None, Some(999), Some(999)); let result : rustnao::Result<Vec<Sauce>> = handle.get_sauce("https://i.pximg.net/img-master/img/2019/02/10/03/11/39/73095123_p0_master1200.jpg");
Fields
ext_urls: Vec<String>
A Vec of Strings representing the external URLs for the image
title: Option<String>
An optional String to represent the title of the image
site: String
A string to represent the site the image is from
index: u32
The official index on SauceNAO for the index the site corresponds to
index_id: u32
The index rerturned by the SauceNAO API. Usually this is equal to the index
but sometimes it is different (see Sankaku, for example)
similarity: f32
The similarity the image has with the guess
thumbnail: String
A string representing the URL of the thumbnail
additional_fields: Option<Value>
Any additional fields that are specific to the source
Methods
impl Sauce
[src]
pub fn has_empty_url(&self) -> bool
[src]
Returns whether the Sauce struct contains an empty ext_url field.
Example
use rustnao::{Handler, Sauce}; let file = "https://i.imgur.com/W42kkKS.jpg"; let mut handle = Handler::new("your_saucenao_api_key", Some(0), None, None, Some(999), Some(999)); handle.set_min_similarity(45); let result = handle.get_sauce(file); if result.is_ok() { let res : Vec<Sauce> = result.unwrap().into_iter().filter(|sauce| sauce.has_empty_url()).collect(); for i in res { println!("{:?}", i); } } else { println!("Failed to make a query."); }
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,