pub struct TitleMatcher { /* private fields */ }Expand description
Canonical title matcher backed by either a local Kitsu dump or a remote GraphQL endpoint.
Construct a matcher once and reuse it for many title lookups.
Implementations§
Source§impl TitleMatcher
impl TitleMatcher
Sourcepub fn new(source: MatchSource) -> MatchResult<Self>
pub fn new(source: MatchSource) -> MatchResult<Self>
Create a matcher from the selected source.
§Examples
use zantetsu_vecdb::{MatchSource, TitleMatcher};
let matcher = TitleMatcher::new(
MatchSource::remote_endpoint("https://graphql.anilist.co"),
)
.unwrap();
let _ = matcher;Sourcepub fn from_kitsu_dump(dump_path: impl Into<PathBuf>) -> MatchResult<Self>
pub fn from_kitsu_dump(dump_path: impl Into<PathBuf>) -> MatchResult<Self>
Create a matcher from a local Kitsu dump path.
Sourcepub fn from_remote_endpoint(endpoint: impl Into<String>) -> MatchResult<Self>
pub fn from_remote_endpoint(endpoint: impl Into<String>) -> MatchResult<Self>
Create a matcher using a remote GraphQL endpoint.
Sourcepub fn match_title(&self, title: &str) -> MatchResult<Option<AnimeTitleMatch>>
pub fn match_title(&self, title: &str) -> MatchResult<Option<AnimeTitleMatch>>
Return the best available match for the provided title.
§Examples
use zantetsu_vecdb::{MatchSource, TitleMatcher};
let matcher = TitleMatcher::new(
MatchSource::remote_endpoint("https://graphql.anilist.co"),
)
.unwrap();
let best = matcher.match_title("Spy x Family").unwrap();
assert!(best.is_some());Sourcepub fn search_titles(
&self,
title: &str,
limit: usize,
) -> MatchResult<Vec<AnimeTitleMatch>>
pub fn search_titles( &self, title: &str, limit: usize, ) -> MatchResult<Vec<AnimeTitleMatch>>
Search for the best matches for the provided title.
Results are ordered from highest score to lowest score.
Auto Trait Implementations§
impl Freeze for TitleMatcher
impl !RefUnwindSafe for TitleMatcher
impl Send for TitleMatcher
impl Sync for TitleMatcher
impl Unpin for TitleMatcher
impl UnsafeUnpin for TitleMatcher
impl !UnwindSafe for TitleMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more