6 releases

new 0.1.5 Jan 5, 2025
0.1.4 Dec 21, 2024
0.1.2 Nov 28, 2024

#1166 in Web programming

Download history 121/week @ 2024-09-18 12/week @ 2024-09-25 4/week @ 2024-10-02 360/week @ 2024-11-27 138/week @ 2024-12-04 2/week @ 2024-12-11 110/week @ 2024-12-18 6/week @ 2024-12-25

257 downloads per month

MIT license

99KB
3K SLoC

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, "水無月 時雨");

Dependencies

~8–20MB
~271K SLoC