vn

Crates.iovn
lib.rsvn
version
sourcesrc
created_at2024-11-27 20:51:41.799938
updated_at2024-12-04 16:13:27.761855
descriptionRust wrapper for the VNDB API
homepagehttps://github.com/ferreira-tb/vn
repositoryhttps://github.com/ferreira-tb/vn
max_upload_size
id1463610
Cargo.toml error:TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Andrew Ferreira (ferreira-tb)

documentation

README

vn

Rust wrapper for the VNDB API.

[dependencies]
vn = 0.1

Usage

Create a new VNDB client:

use vn::Vndb;
use std::time::Duration;

let vndb = Vndb::builder()
  .max_concurrent_requests(5)
  .timeout(Duration::from_secs(10))
  .token("abcd-efghi-jklmn-opqrs-tuvx-z1234-5678")
  .user_agent("the-user-agent/v5.0")
  .build();

Find a visual novel by its id:

use vn::{Vndb, VisualNovelField};

let vndb = Vndb::new();
let results = vndb
  .find_visual_novel(1194)
  .fields(VisualNovelField::Title)
  .send()
  .await
  .unwrap()
  .results;

let visual_novel = results.first().unwrap();
let title = visual_novel.title.as_deref().unwrap();
assert!(title.eq_ignore_ascii_case("Yosuga no Sora"));

Search characters by their name:

use vn::{Vndb, CharacterField, SortCharacterBy};

let vndb = Vndb::new();
let results = vndb
  .search_character("Minazuki Shigure")
  .fields([CharacterField::Name, CharacterField::Original])
  .results(10)
  .sort(SortCharacterBy::Name)
  .send()
  .await
  .unwrap()
  .results;

let character = results.first().unwrap();
let name = character.name.as_deref().unwrap();
let original = character.original.as_deref().unwrap();

assert!(name.eq_ignore_ascii_case("Minazuki Shigure"));
assert_eq!(original, "水無月 時雨");
Commit count: 6

cargo fmt