1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
//! [![ci-badge][]][ci] [![license-badge][]][license] [![docs-badge][]][docs] [![rust badge]][rust link]
//!
//! # iso15924.rs
//!
//! Rust crate for ISO 15924 data, retrieved from unicode.org.
//!
//! Data in the crate is updated every week from [the table] on [unicode.org].
//!
//! Also provided is a constant with the source URL of the data and parsing
//! functionality to parse it, so that you can request the data yourself for the
//! most up-to-date information.
//!
//! ### What is ISO 15924?
//!
//! > ISO 15924, Codes for the representation of names of scripts, defines two sets
//! > of codes for a number of writing systems (scripts). Each script is given both
//! > a four-letter code and a numeric one. Script is defined as "set of graphic
//! > characters used for the written form of one or more languages".
//! >
//! > -- [Wikipedia](https://en.wikipedia.org/wiki/ISO_15924)
//!
//! ### Installation
//!
//! `iso15924` requires at least Rust 1.34.
//!
//! Add the following dependency to your Cargo.toml:
//!
//! ```toml
//! [dependencies]
//!
//! iso15924 = "0.1"
//! ```
//!
//! ### Examples
//!
//! Retrieve a slice of all `ScriptCode` definitions:
//!
//! ```rust
//! use iso15924::ScriptCode;
//!
//! fn main() {
//!     let scripts = ScriptCode::all();
//!
//!     println!("Amount: {}", scripts.len());
//! }
//! ```
//!
//! Retrieve a `ScriptCode` by its number:
//!
//! ```rust
//! use iso15924::ScriptCode;
//!
//! fn main() {
//!     let script = ScriptCode::by_num("412");
//!
//!     if let Some(script) = script {
//!         println!("Script name: {}", script.name);
//!     }
//! }
//! ```
//!
//! For more examples and information please look in the [docs].
//!
//! ### License
//!
//! ISC. License info in [LICENSE.md].
//!
//! [ci-badge]: https://github.com/zeyla/iso15924.rs/workflows/Test/badge.svg
//! [ci]: https://github.com/zeyla/iso15924.rs/actions
//! [docs]: https://docs.rs/iso15924
//! [docs-badge]: https://img.shields.io/badge/docs-online-5023dd.svg?style=flat-square
//! [license-badge]: https://img.shields.io/badge/license-ISC-blue.svg?style=flat-square
//! [license]: https://opensource.org/licenses/ISC
//! [LICENSE.md]: https://github.com/zeyla/iso15924.rs/blob/master/LICENSE.md
//! [rust badge]: https://img.shields.io/badge/rust-1.34+-93450a.svg?style=flat-square
//! [rust link]: https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html
//! [the table]: https://unicode.org/iso15924/iso15924-codes.html
//! [unicode.org]: https://unicode.org

#![deny(
    clippy::all,
    clippy::pedantic,
    future_incompatible,
    missing_docs,
    nonstandard_style,
    rust_2018_idioms,
    unused,
    warnings
)]
#![allow(clippy::module_name_repetitions)]

pub mod code;

mod date;

pub use self::{
    code::ScriptCode,
    date::{ScriptDate, ScriptDateError},
};

/// The URL to the data source. You can request this and then pass it to
/// [`code::parser`] to parse the rows.
///
/// [`code::parser`]: ./code/parser
pub const DATA_URL: &str = "https://www.unicode.org/iso15924/iso15924.txt";