Skip to content

Releases: ClementTsang/RustNAO

0.3.0-alpha-1

09 Nov 03:47
Compare
Choose a tag to compare

With async finally here, I've ticked the version up by one. Note the alpha tag, this is due to the fact that reqwest does not seem to have file functionality built yet for async, and as such, file searching with this wrapper does not work for that. So for now, file searching with async will throw an error, and you should rely on the original (blocking) get_sauce function for that situation. Upon that blocker being fixed, I'll push an update.

Changes

  • As mentioned, async options are now here! To see what it might look like, see this example, but the gist is:
#[tokio::main]
async fn main() -> Result<(), Error> {
	let result = handle.async_get_sauce_as_pretty_json("https://i.imgur.com/W42kkKS.jpg", None, None);
}
  • HandlerBuilder::new() is no longer a thing; use HandlerBuilder::default() and build from there. It should therefore look like:
let handle = HandlerBuilder::default()
			.api_key(key)
			.num_results(999)
			.db_mask([Handler::PIXIV, Handler::SANKAKU_CHANNEL].to_vec())
			.build();
  • Both the testmode and num_results fields in the Handler are now of type Option<u32>, rather than Option<i32>.

  • Some optimizations here and there in terms of code structure/reuse.

  • Some changes due to the updating of dependencies.

0.2.1 Release

30 Jun 05:51
Compare
Choose a tag to compare

0.2.1 is a minor release, with the only addition being a Builder pattern being made for Handler creation.

This will likely mean that Handler::new(...) will be deprecated in a future release; for now both the builder and Handler::new(...) are left available.

See documentation for how to use the builder, but the gist of it is:

extern crate rustnao;
use rustnao::{HandlerBuilder, Handler};

fn main() {
    let handle : Handler = HandlerBuilder::new().api_key("key").num_results(15).build();
    handle.get_sauce("file", None, None);
}

One advantage that using HandlerBuilder has over Handler::new(...) is that HandlerBuilder has support for setting minimum similarity and whether to filter out empty URL results upon creation.

Beyond that, not much has changed, just documentation updates to reflect this new feature.

0.2.0 Release

26 Jun 03:20
1ce4603
Compare
Choose a tag to compare

Pushed up a version due to the new changes breaking old use cases. The following has been added/changed:

get_sauce and it's derivatives have been changed.

They now require three parameters, the first being the mandatory file path, and the second and third being an Option to the number of results and the minimum similarity respectively. For example:

use rustnao::Handler;
let handle = Handler::new("your_saucenao_api_key", Some(0), None, None, Some(999), Some(999));
handle.get_sauce("./tests/test.jpg", None, None);

This was added to allow for temporary filtering on a per-get_sauce basis. Permanently changing the minimum similarity still requires the set_min_similarity function, and you can only set the max number of results on the initial Handler call.

Added ToJSON trait to make converting from Vec to a JSON string easier. For example:

use rustnao::{Handler, ToJSON};
let handle = Handler::new("your_saucenao_api_key", Some(0), None, None, Some(999), Some(999));
let result = handle.get_sauce("./tests/test.jpg", None, None);
if result.is_ok() {
 	result.unwrap().to_json();
 }

Both functions to go to JSON and pretty JSON are provided.

Added set_empty_filter, which allows you to permanently filter out empty URL search results.

handle.set_empty_filter(true); // Will automatically remove empty ext_url Vectors for all get_sauce until changed

Check documentation for more details.

In addition:

  • Updated documentation
  • Added test documentation

0.1.4

16 Jun 06:25
Compare
Choose a tag to compare

Added support for local files. See the example for how it works.

0.1.3

15 Jun 20:54
Compare
Choose a tag to compare

Removed the need for a pesky mut in front of Handler.

cargo-release-0.1.1

09 Jun 03:21
Compare
Choose a tag to compare

Initial release.