[][src]Struct rustnao::HandlerBuilder

pub struct HandlerBuilder { /* fields omitted */ }

A builder to create a Handler for RustNAO usage.

Example

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().api_key("your_api_key").num_results(999).db(999).build();

Methods

impl HandlerBuilder[src]

pub fn new() -> HandlerBuilder[src]

Creates a new HandlerBuilder, which is to be used to build a Handler for RustNAO.

Examples

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().api_key("your_api_key").num_results(999).db(999).build();

pub fn api_key(&mut self, api_key: &str) -> &mut HandlerBuilder[src]

Sets the API key used for searches for the Handler. If this is not set then a blank API key is used, instead of your personal one.

Arguments

  • api_key - A string reference representing your API key.

Examples

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().api_key("your_api_key").build();

pub fn testmode(&mut self, testmode: bool) -> &mut HandlerBuilder[src]

Sets whether testmode should be enabled on searches for the Handler. If this is on, then each index will output at most one result. If this is unset then it is set to off by default.

Arguments

  • testmode - A boolean representing whether you want testmode to be set to on (true) or off (false).

Examples

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().testmode(true).build();

pub fn db_mask(&mut self, db_mask: Vec<u32>) -> &mut HandlerBuilder[src]

Sets which database indices you want included on search for the Handler. If both db and db_mask are not set, then every index is checked (db_mask_i will still apply).

Arguments

  • db_mask - A vector of u32s representing the database indices you wish to have included in your search.

Examples

use rustnao::{Handler, HandlerBuilder};
let handle = HandlerBuilder::new().db_mask([1, 2, Handler::PIXIV].to_vec()).build();

pub fn db_mask_i(&mut self, db_mask_i: Vec<u32>) -> &mut HandlerBuilder[src]

Sets which database indices you want excluded on search for the Handler.

Arguments

  • db_mask_i - A vector of u32s representing the database indices you wish to have excluded in your search.

Examples

use rustnao::{Handler, HandlerBuilder};
let handle = HandlerBuilder::new().db_mask_i([1, 2, Handler::PIXIV].to_vec()).build();

pub fn db(&mut self, db: u32) -> &mut HandlerBuilder[src]

Sets a database index to be searched for the Handler. If both db and db_mask are not set, then every index is checked (db_mask_i will still apply).

Arguments

  • db - A u32 representing which database index you want included. Set it to 999 to include every index.

Examples

use rustnao::{Handler, HandlerBuilder};
let handle = HandlerBuilder::new().db(Handler::PIXIV).build();

pub fn num_results(&mut self, num_results: u32) -> &mut HandlerBuilder[src]

Sets the maximum number of results you want returned on search for the Handler. You can change this number per-search. If this is not set, by default this is set to return at most 999 results.

Arguments

  • num_results - A u32 value representing how many results you want returned.

Examples

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().num_results(10).build();

pub fn min_similarity<T: Into<f64>>(
    &mut self,
    min_similarity: T
) -> &mut HandlerBuilder
[src]

Sets he minimum similarity for results by default for the Handler. You can change this number per-search. If this is not set, by default it is 0.0 (no minimum similarity).

Arguments

  • min_similarity : A number that can be cast into a f64 representing the minimum similarity (in percent) of a result to be returned.

Examples

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().min_similarity(50.5).build();

pub fn empty_filter_enabled(
    &mut self,
    empty_filter_enabled: bool
) -> &mut HandlerBuilder
[src]

Sets whether to enable an empty filter by default for the Handler. If this is not set, by default it is false.

Arguments

  • empty_filter_enabled : A boolean representing whether you want empty URL search results to be filtered out by default.

Examples

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().empty_filter_enabled(true).build();

pub fn build(&mut self) -> Handler[src]

Builds the HandlerBuilder, returning a Handler that can be used to search.

Examples

use rustnao::HandlerBuilder;
let handle = HandlerBuilder::new().api_key("your_api_key").db(999).num_results(50).build();

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err