Struct imdb_async::Client

source ·
pub struct Client { /* private fields */ }
Expand description

A client to IMDB’s dataset

Implementations§

source§

impl Client

source

pub async fn new( cache_invalidation_time: Duration, cache_directory: impl AsRef<Path> + Send + Sync ) -> Result<Self, Error>

Instantiates a new Client

source

pub async fn get_title(&mut self, id: u32) -> Result<Title, Error>

Returns a single Title by ID.

source

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.

source

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.

source

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.

source

pub async fn get_movie(&mut self, id: u32) -> Result<Movie, Error>

Returns a single Movie by ID.

source

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.

source

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.

source

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.

source

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.

source

pub async fn get_show(&mut self, id: u32) -> Result<Show, Error>

Returns a single Show by ID.

source

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.

source

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more