Crate tmdb_sans_io

Crate tmdb_sans_io 

Source
Expand description

§The Movie Database

The Movie Database

This is a fork of tmdb (Cir0X/tmdb-rs), following the sans-io approach to let you build a custom wrapper around TMDb API.

Bring your own I/O stack!

§Motivation

Why yet another TMDb API library written in Rust?

For a throw-away hobby project, I needed to access TMDb API:

  • The search on lib.rs lists several crate implementations, great!
  • Looking among the results (at the time of writing) some require async runtimes… but tmdb (Cir0X/tmdb-rs) doesn’t, nice!
    • N.B. I’m not hating on async, just for this project pulling an async runtime seemed like overkill. If I did pull in an async runtime, I wanted it to be on my terms.
  • Running cargo audit, it seems one dependency of the chosen library (the latest reqwest version 0.9.24 per the semver range, from 2019-12-11) has security advisories.

The situation is understandable: an older but still working API access library (last updated in 2021) that uses an older version of HTTP client library is bound to have a few security vulnerabilities reported deep in their dependency tree.

Security advisories (in this case, DDOS vulnerabilities) may not be critical for a hobby project but are still not ideal.

Instead of manually patching the API access library to use an updated HTTP client library, why not decouple the API models from the HTTP client?

Credit goes to the original authors for the data models, and API design. Building upon that, the finish method is crudely bolted on, returning an HttpGet struct containing the URL to be queried and a receive_response method to parse the JSON response.

Modules§

model
themoviedb