ucd-0.1.1/.gitignore00006440000765000002400000000073127452526400012501 0ustar0000000000000000target Cargo.lock *.swp __pycache__ .DS_Store tests/data/* ucd-0.1.1/.travis.yml00006440000765000002400000000151127455112200012607 0ustar0000000000000000language: rust script: - ./prepare.sh - cargo build --release --verbose - cargo test --release --verbose ucd-0.1.1/Cargo.toml00006440000765000002400000002077127462473330012453 0ustar0000000000000000# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] name = "ucd" version = "0.1.1" authors = ["sourtin "] exclude = [ "tests/*", "data/*", ] description = """ Extends the char type to provide access to most fields of the UCD, Unicode Character Database, as of version 9.0.0. It aims to be compact, fast, and use minimal dependencies (only rust's core crate). Not all properties are included, most notably character names. """ homepage = "https://github.com/sourtin/libucd" readme = "README.md" keywords = [ "text", "unicode", "ucd", "character", ] license = "MIT" repository = "https://github.com/sourtin/libucd" [dependencies] ucd-0.1.1/Cargo.toml.orig00006440000765000002400000001120127462473330013376 0ustar0000000000000000[package] name = "ucd" version = "0.1.1" authors = ["sourtin "] homepage = "https://github.com/sourtin/libucd" repository = "https://github.com/sourtin/libucd" license = "MIT" keywords = ["text", "unicode", "ucd", "character"] readme = "README.md" description = """ Extends the char type to provide access to most fields of the UCD, Unicode Character Database, as of version 9.0.0. It aims to be compact, fast, and use minimal dependencies (only rust's core crate). Not all properties are included, most notably character names. """ exclude = ["tests/*", "data/*"] [dependencies] ucd-0.1.1/LICENSE00006440000765000002400000002041127452544610011516 0ustar0000000000000000Copyright (c) 2016 William Earley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.ucd-0.1.1/LICENSE-UCD00006440000765000002400000003616127452526400012135 0ustar0000000000000000COPYRIGHT AND PERMISSION NOTICE Copyright © 1991-2016 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy of the Unicode data files and any associated documentation (the "Data Files") or Unicode software and any associated documentation (the "Software") to deal in the Data Files or Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Data Files or Software, and to permit persons to whom the Data Files or Software are furnished to do so, provided that (a) this copyright and permission notice appear with all copies of the Data Files or Software, (b) this copyright and permission notice appear in associated documentation, and (c) there is clear notice in each modified Data File or in the Software as well as in the documentation associated with the Data File(s) or Software that the data or software has been modified. THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in these Data Files or Software without prior written authorization of the copyright holder. ucd-0.1.1/prepare.sh00007550000765000002400000000056127455124240012506 0ustar0000000000000000#!/bin/bash cd tests tar xf data.tar.xz cd .. ucd-0.1.1/README.md00006440000765000002400000022641127462421750012000 0ustar0000000000000000# `libucd` [![Build Status](https://travis-ci.org/sourtin/libucd.svg?branch=master)](https://travis-ci.org/sourtin/libucd) [![crates.io](http://meritbadge.herokuapp.com/ucd)](https://crates.io/crates/ucd) This library extends the inbuilt `char` type with the `Codepoint` trait, which implements 100 properties of the UCD (Unicode Character Database). It aims to be fast and compact, and to have minimal dependencies (it does not require the rust standard library so only needs rust's `core` crate). ```rust extern crate ucd; use ucd::Codepoint; fn main() { let salawat: char = 'ﷺ'; let decomp: String = salawat.decomposition_map().collect(); println!("{} -> {}", salawat, decomp); // ﷺ -> صلى الله عليه وسلم } ``` Though the library is fairly extensive, it is not complete. The properties it lacks are: * Character [names](https://github.com/huonw/unicode_names) and aliases * Unihan properties * Tangut source data * Named sequences * Standardised variants * CJK Radicals * Emoji source data Data was compressed as arrays of ranges of codepoints having each value for each property, excluding the most common value. Lookup is then implemented by a binary search which should provide O(1) access. A very unscientific test suggests each lookup takes around 100ns on a core i5 processor. ## Disclaimer Please note that this data has been derived from the flat XML version of the UCD. Though this is published by Unicode, it is not the official version of the database. As such, it cannot be guaranteed that this library is entirely consistent with the official database. The unit tests do however suggest consistency with the XML database at least. ## Reference _Note, in most cases enum values are simply the full name of the property value converted to camelcase. Perhaps I will eventually create a rustdoc version that will be more helpful._ In the tables below, the first column is the name of the property, and the second column is the method name. The methods are implemented via the `ucd::Codepoint` trait on `char`. | General | Method | Return Type | Note | | ---- | --- | --- | --- | | Age | `age` | `Option<(u8,u8)>` | Return `None` if the character is unassigned, else a tuple of major and minor age | | Block | `block` | `Option` | | | General_Category | `category` | `UnicodeCategory` | Return `Unassigned` if unassigned | | ISO_Comment (deprecated, stabilized) | `iso_comment` | `&str` | All characters are null, i.e. `""` is returned | | Function and Appearance | Method | Return Type | Note | | ---- | --- | --- | --- | | Alphabetic | `Codepoint::is_alphabetic` or `is_alpha` | `bool` | Rust's `char` already defines a method `is_alphabetic` which shadows this implementation and provides slightly different results (possibly by using an outdated version of the UCD). Use the namespace, or the `is_alpha` alias instead. | | ASCII_Hex_Digit | `is_hex_digit_ascii` | `bool` | | | Dash | `is_dash` | `bool` | | | Default_Ignorable_Code_Point | `is_default_ignorable` | `bool` | | | Deprecated | `is_deprecated` | `bool` | | | Diacritic | `is_diacritic` | `bool` | | | Extender | `is_extender` | `bool` | | | Hex_Digit | `is_hex_digit` | `bool` | | | Hyphen _(deprecated, stabilized)_ | `is_hyphen` | `bool` | | | Logical_Order_Exception | `is_logical_order_exception` | `bool` | | | Math | `is_math` | `bool` | | | Noncharacter_Code_Point | `is_noncharacter` | `bool` | | | Other_Alphabetic | `is_alphabetic_other` | `bool` | | | Other_Default_Ignorable_Code_Point | `is_default_ignorable_other` | `bool` | | | Other_Math | `is_math_other` | `bool` | | | Prepended_Concatenation_Mark | `is_prepended_concatentation_mark` | `bool` | | | Quotation_Mark | `is_quotation_mark` | `bool` | | | Sentence_Terminal | `is_sentence_terminal` | `bool` | | | Soft_Dotted | `is_soft_dotted` | `bool` | | | Terminal_Punctuation | `is_terminal_punctuation` | `bool` | | | Variation_Selector | `is_variation_selector` | `bool` | | | White_Space | `Codepoint::is_whitespace` or `is_white` | `bool` | Again, `char` shadows this with its own implementation so use the namespace or alias. | | Numeric | Method | Return Type | Note | | ---- | --- | --- | --- | | Numeric_Type | `numeric_type` | `Option` | | | Numeric_Value | `numeric_value` | `Option` | The `Number` type is an enum of `Integer(i64)` and `Rational(i32,u32)`, to cover values as large as 10^12 and as small as 1/160. | | Identifiers and Syntax | Method | Return Type | Note | | ---- | --- | --- | --- | | ID_Continue | `is_id_continue` | `bool` | | | ID_Start | `is_id_start` | `bool` | | | Other_ID_Continue | `is_id_continue_other` | `bool` | | | Other_ID_Start | `is_id_start_other` | `bool` | | | Pattern_Syntax | `is_pattern_syntax` | `bool` | | | Pattern_White_Space | `is_pattern_whitespace` | `bool` | | | XID_Continue | `is_id_continue_nfkc` | `bool` | | | XID_Start | `is_id_start_nfkc` | `bool` | | | Scripts | Method | Return Type | Note | | ---- | --- | --- | --- | | East_Asian_Width | `east_asian_width` | `EastAsianWidth` | | | Hangul_Syllable_Type | `hangul_syllable_type` | `Option` | | | Ideographic | `is_ideograph` | `bool` | | | IDS_Binary_Operator | `is_ideograph_description_sequence_binary_operator` | `bool` | | | IDS_Trinary_Operator | `is_ideograph_description_sequence_trinary_operator` | `bool` | | | Indic_Positional_Category | `indic_positional_category` | `Option` | | | Indic_Syllabic_Category | `indic_syllabic_category` | `Option` | | | Jamo_Short_Name | `jamo_short_name` | `Option<&str>` | | | Join_Control | `join_control` | `bool` | | | Joining_Group | `joining_group` | `JoiningGroup` | | | Joining_Type | `joining_type` | `JoiningType` | | | Radical | `is_ideograph_description_sequence_radical` | `bool` | | | Script | `script` | `Option