codes_iso_639/
lib.rs

1/*!
2This package contains an implementation of the ISO 639
3[part 1](https://www.iso.org/standard/22109.html),
4[part 3](https://www.iso.org/standard/39534.html), and
5[part 5](https://www.iso.org/standard/39536.html)
6Language Code specifications.
7
8ISO 639-1, the two-character code, was devised primarily for use in
9terminology and includes identifiers for most of the major languages of the
10world that are not only most frequently represented in the total body of the
11world's literature, but that are also among the most developed languages of
12the world, having specialized vocabulary and terminology. ISO 639-1 includes
13identifiers for a subset of the languages covered by ISO 639-2.
14
15ISO 639-2, the three-character code, was devised primarily for use in
16bibliography, as well as in terminology. It has a less restrictive scope than
17ISO 639-1, being devised to include identifiers for languages that are most
18frequently represented in the total body of the world's literature, regardless
19of whether specialized terminologies exist in those languages or not. Because
20three characters allow for a much larger set of distinct identifiers, an
21alpha-3 code can accommodate a much larger set of languages. Indeed, ISO 639-2
22does include significantly more entries than ISO 639-1, yet the scope is not
23so broad as to result in a separate identifier for every individual language
24that has been documented. ISO 639-2 limits coverage of individual languages to
25those for which at least modest bodies of literature have been developed.
26Other languages are still accommodated, however, by means of identifiers for
27collections of languages, such as language families.
28
29In summary, the basic difference between ISO 639-1 and ISO 639-2 has to do
30with scope: the scope of ISO 639-1 is more restrictive, focusing on languages
31for which specialized terminologies have been developed. In practical terms,
32ISO 639-2 covers a larger number of individual languages (due to its
33less-restrictive scope). It also includes identifiers for collections of
34languages.
35
36# Example
37
38```rust
39use codes_iso_639::part_1::LanguageCode;
40
41let code = LanguageCode::Fr;
42
43assert_eq!(code.as_ref(), "fr");
44assert_eq!(code.language_name(), "French");
45```
46
47# Features
48
49By default only the `serde` feature is enabled, and [part_1] two-letter
50language codes.
51
52* `serde` - Enables serialization of the different Language Code types.
53* `part_3` - Adds the ISO 639-3 three-letter language codes.
54  * `comment` - Adds the `LanguageCode::comment` method.
55  * `language_type` - Adds the `LanguageCode::language_type` method.
56  * `macro_individuals` - Adds the `LanguageCode::macro_individuals` method.
57  * `scope` - Adds the `LanguageCode::scope` method.
58* `part_5` - Adds the ISO 639-5 three-letter language family or group codes.
59
60*/
61
62#![warn(
63    unknown_lints,
64    // ---------- Stylistic
65    absolute_paths_not_starting_with_crate,
66    elided_lifetimes_in_paths,
67    explicit_outlives_requirements,
68    macro_use_extern_crate,
69    nonstandard_style, /* group */
70    noop_method_call,
71    rust_2018_idioms,
72    single_use_lifetimes,
73    trivial_casts,
74    trivial_numeric_casts,
75    // ---------- Future
76    future_incompatible, /* group */
77    rust_2021_compatibility, /* group */
78    // ---------- Public
79    missing_debug_implementations,
80    // missing_docs,
81    unreachable_pub,
82    // ---------- Unsafe
83    unsafe_code,
84    unsafe_op_in_unsafe_fn,
85    // ---------- Unused
86    unused, /* group */
87)]
88#![deny(
89    // ---------- Public
90    exported_private_dependencies,
91    private_in_public,
92    // ---------- Deprecated
93    anonymous_parameters,
94    bare_trait_objects,
95    ellipsis_inclusive_range_patterns,
96    // ---------- Unsafe
97    deref_nullptr,
98    drop_bounds,
99    dyn_drop,
100)]
101
102// ------------------------------------------------------------------------------------------------
103// Public Types
104// ------------------------------------------------------------------------------------------------
105
106pub use codes_common::CodeParseError as LanguageCodeError;
107
108// ------------------------------------------------------------------------------------------------
109// Modules
110// ------------------------------------------------------------------------------------------------
111
112pub mod part_1;
113
114#[cfg(feature = "part_3")]
115pub mod part_3;
116
117#[cfg(feature = "part_5")]
118pub mod part_5;