[][src]Crate iso15924

ci-badge license-badge docs-badge rust badge

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

Installation

iso15924 requires at least Rust 1.34.

Add the following dependency to your Cargo.toml:

[dependencies]

iso15924 = "0.1"

Examples

Retrieve a slice of all ScriptCode definitions:

use iso15924::ScriptCode;

fn main() {
    let scripts = ScriptCode::all();

    println!("Amount: {}", scripts.len());
}

Retrieve a ScriptCode by its number:

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.

Re-exports

pub use self::code::ScriptCode;

Modules

code

The ScriptCode definition with provided parsing functionality.

Structs

ScriptDate

Representation of a date of introduction for a script code. This contains year, month, and day public fields of u16 type.

Enums

ScriptDateError

Error enum when parsing a ScriptDate fails.

Constants

DATA_URL

The URL to the data source. You can request this and then pass it to code::parser to parse the rows.