Struct imdb_async::Client
source · [−]pub struct Client { /* private fields */ }
Expand description
A client to IMDB’s dataset
Implementations
sourceimpl Client
impl Client
sourcepub async fn new(
cache_invalidation_time: Duration,
cache_directory: impl AsRef<Path>
) -> Result<Self, Error>
pub async fn new(
cache_invalidation_time: Duration,
cache_directory: impl AsRef<Path>
) -> Result<Self, Error>
Instantiates a new Client
sourcepub async fn get_title(&mut self, id: u32) -> Result<Title, Error>
pub async fn get_title(&mut self, id: u32) -> Result<Title, Error>
Returns a single Title by ID.
sourcepub async fn get_titles(&mut self, ids: &[u32]) -> Result<Vec<Title>, Error>
pub async fn get_titles(&mut self, ids: &[u32]) -> Result<Vec<Title>, Error>
Returns a list of Titles given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn stream_titles(
&mut self
) -> Result<impl Stream<Item = Result<Title, Error>>, Error>
pub async fn stream_titles(
&mut self
) -> Result<impl Stream<Item = Result<Title, Error>>, Error>
Streams all Titles from persistent storage. In relational database parlance, this is analogous to a tablescan.
sourcepub async fn get_movie_by_name_and_year(
&mut self,
name: &str,
year: u16
) -> Result<Option<Movie>, Error>
pub async fn get_movie_by_name_and_year(
&mut self,
name: &str,
year: u16
) -> Result<Option<Movie>, Error>
Looks up a Movie by name and year. This is slow, as the cache is not keyed on those fields; a tablescan is performed. Returns Ok(None) if no match is found, not Error::NotFound.
sourcepub async fn get_movie(&mut self, id: u32) -> Result<Movie, Error>
pub async fn get_movie(&mut self, id: u32) -> Result<Movie, Error>
Returns a single Movie by ID.
sourcepub async fn get_movies(&mut self, ids: &[u32]) -> Result<Vec<Movie>, Error>
pub async fn get_movies(&mut self, ids: &[u32]) -> Result<Vec<Movie>, Error>
Returns a list of Movies given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn stream_movies(
&mut self
) -> Result<impl Stream<Item = Result<Movie, Error>>, Error>
pub async fn stream_movies(
&mut self
) -> Result<impl Stream<Item = Result<Movie, Error>>, Error>
Streams all Movies from persistnet storage. In relational database parlance, this is analogous to a tablescan.
sourcepub async fn get_show_by_name_and_year(
&mut self,
name: &str,
year: u16
) -> Result<Option<Show>, Error>
pub async fn get_show_by_name_and_year(
&mut self,
name: &str,
year: u16
) -> Result<Option<Show>, Error>
Looks up a Show by name and year. This is slow, as the cache is not keyed on those fields; a tablescan is performed. Returns Ok(None) if not match is found, not Error::NotFound.
sourcepub async fn get_shows(&mut self, ids: &[u32]) -> Result<Vec<Show>, Error>
pub async fn get_shows(&mut self, ids: &[u32]) -> Result<Vec<Show>, Error>
Returns a list of Shows given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn get_shows_by_id(
&mut self,
ids: &[u32]
) -> Result<HashMap<u32, Show, FnvBuildHasher>, Error>
pub async fn get_shows_by_id(
&mut self,
ids: &[u32]
) -> Result<HashMap<u32, Show, FnvBuildHasher>, Error>
Returns a map<ID, Show> given a list of IDs. Missing IDs are ignored; Error::NotFound is not returned.
sourcepub async fn get_episodes_by_show(
&mut self,
show_ids: &[u32]
) -> Result<HashMap<u32, Vec<Episode>, FnvBuildHasher>, Error>
pub async fn get_episodes_by_show(
&mut self,
show_ids: &[u32]
) -> Result<HashMap<u32, Vec<Episode>, FnvBuildHasher>, Error>
Returns a map<Show ID, Vec<Episode>> given a list of Show IDs. Missing IDs are ignored; Error::NotFound is not returned.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more