Enum imdb::Language [] [src]

pub enum Language {
    en_US,
    en_GB,
    it_IT,
    fr_FR,
    de_DE,
    da_DK,
}

Options for IMDb language support via Accept-Language

IMDb shows content in various languages based on Accept-Language header present in HTTP request. This library supports fetching content in different languages.

This list is just a start. If there are other languages in which IMDb shows content but no options are provided here, open an issue.

Example

Be careful when using this code, it's not being tested!
use imdb::{IMDb, Language};

let imdb = IMDb::new();
imdb.accept_language(Languages::fr_FR)

top_250 = imdb.top250_movies().unwrap();

assert_eq!("Les évadés", top_250[0].title);
assert_eq!("Le parrain", top_250[1].title);

Why Typed?

Or why not stringly-typed?

Under the hood, this library uses hyper which is highly opiniated about how headers should be presented.

Hyper has the opinion that Headers should be strongly-typed, because that's why we're using Rust in the first place. To set or get any header, an object must implement the Header trait from this module.

In the same spirit, this library restricts string based options.

References

  • Tags for Identifying Languages BCP47
  • HTTP/1.1 Semantics and Content # Accept-Language RFC7231

Variants

American English

British English

Italian (Italy)

French (France)

German (German)

Danish (Denmark)

Methods

impl Language
[src]

[src]

Returns Accept-Language Header of Language Option

[src]

Returns Description of Language Option

Trait Implementations

impl Display for Language
[src]

[src]

Formats the value using the given formatter. Read more