unic-common-0.9.0/Cargo.toml.orig010064400007650000024000000014451343664667500151020ustar0000000000000000[package] name = "unic-common" version = "0.9.0" edition = "2018" authors = ["The UNIC Project Developers"] repository = "https://github.com/open-i18n/rust-unic/" license = "MIT/Apache-2.0" description = "UNIC — Common Utilities" keywords = ["unicode", "version"] categories = ["internationalization", "text-processing"] # No tests/benches that depends on /data/ exclude = [] [features] default = [] unstable = [] # Rust nightly features [badges] maintenance = { status = "actively-developed" } is-it-maintained-issue-resolution = { repository = "open-i18n/rust-unic" } is-it-maintained-open-issues = { repository = "open-i18n/rust-unic" } appveyor = { repository = "open-i18n/rust-unic", branch = "master", service = "github" } travis-ci = { repository = "open-i18n/rust-unic", branch = "master" } unic-common-0.9.0/Cargo.toml0000644000000023630000000000000113270ustar00# 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 believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] edition = "2018" name = "unic-common" version = "0.9.0" authors = ["The UNIC Project Developers"] exclude = [] description = "UNIC — Common Utilities" keywords = ["unicode", "version"] categories = ["internationalization", "text-processing"] license = "MIT/Apache-2.0" repository = "https://github.com/open-i18n/rust-unic/" [features] default = [] unstable = [] [badges.appveyor] branch = "master" repository = "open-i18n/rust-unic" service = "github" [badges.is-it-maintained-issue-resolution] repository = "open-i18n/rust-unic" [badges.is-it-maintained-open-issues] repository = "open-i18n/rust-unic" [badges.maintenance] status = "actively-developed" [badges.travis-ci] branch = "master" repository = "open-i18n/rust-unic" unic-common-0.9.0/README.md010064400007650000024000000005011343520353600134420ustar0000000000000000# UNIC — Common Utilities [![Crates.io](https://img.shields.io/crates/v/unic-common.svg)](https://crates.io/crates/unic-common) [![Documentation](https://docs.rs/unic-common/badge.svg)](https://docs.rs/unic-common/) This UNIC component provides common types, algorithms and macros not shared between many components. unic-common-0.9.0/src/lib.rs010064400007650000024000000017141343520353600140750ustar0000000000000000// Copyright 2017 The UNIC Project Developers. // // See the COPYRIGHT file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![no_std] #![warn( bad_style, missing_debug_implementations, missing_docs, unconditional_recursion )] #![forbid(unsafe_code)] #![cfg_attr(feature = "unstable", feature(unicode_version))] //! # UNIC — Common Utilities //! //! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/). //! //! This UNIC component provides common types, algorithms and macros not shared between many //! components. mod pkg_info; pub use crate::pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION}; pub mod version; unic-common-0.9.0/src/pkg_info.rs010064400007650000024000000013121343520353600151150ustar0000000000000000// Copyright 2017 The UNIC Project Developers. // // See the COPYRIGHT file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! Package information /// UNIC component version. pub const PKG_VERSION: &str = env!("CARGO_PKG_VERSION"); /// UNIC component name. pub const PKG_NAME: &str = env!("CARGO_PKG_NAME"); /// UNIC component description. pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION"); unic-common-0.9.0/src/version.rs010064400007650000024000000041461343520353600150160ustar0000000000000000// Copyright 2017 The UNIC Project Developers. // // See the COPYRIGHT file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! *Version* data types. use core::fmt; #[cfg(feature = "unstable")] use core::char; /// Represents a *Unicode Version* type. /// /// UNIC's *Unicode Version* type is used for Unicode datasets and specifications, including The /// Unicode Standard (TUS), Unicode Character Database (UCD), Common Local Data Repository (CLDR), /// IDNA, Emoji, etc. /// /// TODO: *Unicode Version* is guaranteed to have three integer fields between 0 and 255. We are /// going to switch over to `u8` after Unicode 11.0.0 release. /// /// Refs: /// - /// - #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Debug, Hash, Default)] pub struct UnicodeVersion { /// Major version. pub major: u16, /// Minor version. pub minor: u16, /// Micro (or Update) version. pub micro: u16, } impl fmt::Display for UnicodeVersion { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}.{}.{}", self.major, self.minor, self.micro) } } #[cfg(feature = "unstable")] /// Convert from Rust's internal Unicode Version. impl From for UnicodeVersion { fn from(value: char::UnicodeVersion) -> UnicodeVersion { UnicodeVersion { major: value.major as u16, minor: value.minor as u16, micro: value.micro as u16, } } } #[cfg(test)] mod tests { #[cfg(feature = "unstable")] #[test] fn test_against_rust_internal() { use core::char; use super::UnicodeVersion; let core_unicode_version: UnicodeVersion = char::UNICODE_VERSION.into(); assert!(core_unicode_version.major >= 10); } } unic-common-0.9.0/.cargo_vcs_info.json0000644000000001120000000000000133170ustar00{ "git": { "sha1": "5878605364af97a3358368a6eaef02104af2e016" } }