Skip to content

Commit

Permalink
Adds bindings needed for the unum.h header
Browse files Browse the repository at this point in the history
This will allow us to implement the functionality in `unum.h`

Issue google#141.
  • Loading branch information
filmil committed Jun 24, 2020
1 parent 6c4eea0 commit 3076e55
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
"rust_icu_ulistformatter",
"rust_icu_uloc",
"rust_icu_umsg",
"rust_icu_unum",
"rust_icu_upluralrules",
"rust_icu_ustring",
"rust_icu_utext",
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ publish:
$(call publish,rust_icu_ulistformatter)
$(call publish,rust_icu_upluralrules)
$(call publish,rust_icu_uformattable)
$(call publish,rust_icu_unum)
$(call publish,rust_icu)

# A helper to up-rev the cargo crate versions.
Expand Down Expand Up @@ -166,6 +167,7 @@ uprev:
$(call uprev,rust_icu_ustring)
$(call uprev,rust_icu_utext)
$(call uprev,rust_icu_uformattable)
$(call uprev,rust_icu_unum)

cov:
./build/showprogress.sh
9 changes: 7 additions & 2 deletions rust_icu_sys/bindgen/run_bindgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ readonly BINDGEN_SOURCE_MODULES=(
"uformattable"
"ulistformatter"
"umsg"
"unum"
"upluralrules"
"uset"
"ustring"
Expand All @@ -62,12 +63,15 @@ readonly BINDGEN_ALLOWLIST_TYPES=(
"UData.*"
"UDate.*"
"UDateFormat.*"
"UDisplayContext.*"
"UEnumeration.*"
"UErrorCode"
"UFormattable.*",
"UFormat.*"
"UFormattedList.*"
"UListFormatter.*"
"UMessageFormat"
"UNUM.*"
"UNumber.*",
"UParseError"
"UPlural.*"
"USet"
Expand All @@ -84,12 +88,13 @@ readonly BINDGEN_ALLOWLIST_FUNCTIONS=(
"udat_.*"
"udata_.*"
"uenum_.*"
"ufmt_.*"
"ulistfmt_.*"
"uloc_.*"
"umsg_.*"
"unum_.*"
"uplrules_.*"
"utext_.*"
"ufmt_.*"
)

function check_requirements() {
Expand Down
4 changes: 4 additions & 0 deletions rust_icu_sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ mod inner {
"uformattable",
"ulistformatter",
"umsg",
"unum",
"upluralrules",
"uset",
"ustring",
Expand All @@ -66,6 +67,7 @@ mod inner {
"ulistfmt_.*",
"uloc_.*",
"umsg_.*",
"unum_.*",
"uplrules_.*",
"utext_.*",
];
Expand All @@ -83,13 +85,15 @@ mod inner {
"UData.*",
"UDate.*",
"UDateFormat.*",
"UDisplayContext.*",
"UEnumeration.*",
"UErrorCode",
"UFormat.*",
"UFormattedList.*",
"UListFormatter.*",
"UMessageFormat",
"UNUM.*",
"UNumber.*",
"UParseError",
"UPlural.*",
"USet",
Expand Down
68 changes: 68 additions & 0 deletions rust_icu_unum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[package]
authors = ["Google Inc."]
edition = "2018"
license = "Apache-2.0"
name = "rust_icu_unum"
readme = "README.md"
repository = "https://github.com/google/rust_icu"
version = "0.3.1"
default-features = false
keywords = ["icu", "unicode", "i18n", "l10n"]

description = """
Native bindings to the ICU4C library from Unicode.
- ufmt.h: Number formatting support
"""

[dependencies]
log = "0.4.6"
paste = "0.1.5"
rust_icu_common = { path = "../rust_icu_common", version = "0.3.1", default-features = false }
rust_icu_sys = { path = "../rust_icu_sys", version = "0.3.1", default-features = false }
rust_icu_ustring = { path = "../rust_icu_ustring", version = "0.3.1", default-features = false }
anyhow = "1.0.25"

[dev-dependencies]
anyhow = "1.0.25"

# See the feature description in ../rust_icu_sys/Cargo.toml for details.
[features]
default = ["use-bindgen", "renaming", "icu_config"]

use-bindgen = [
"rust_icu_common/use-bindgen",
"rust_icu_sys/use-bindgen",
"rust_icu_ustring/use-bindgen",
]
renaming = [
"rust_icu_common/renaming",
"rust_icu_sys/renaming",
"rust_icu_ustring/renaming",
]
icu_config = [
"rust_icu_common/icu_config",
"rust_icu_sys/icu_config",
"rust_icu_ustring/icu_config",
]
icu_version_in_env = [
"rust_icu_common/icu_version_in_env",
"rust_icu_sys/icu_version_in_env",
"rust_icu_ustring/icu_version_in_env",
]
icu_version_64_plus = [
"rust_icu_common/icu_version_64_plus",
"rust_icu_sys/icu_version_64_plus",
"rust_icu_ustring/icu_version_64_plus",
]
icu_version_67_plus = [
"rust_icu_common/icu_version_67_plus",
"rust_icu_sys/icu_version_67_plus",
"rust_icu_ustring/icu_version_67_plus",
]

[badges]
maintenance = { status = "actively-developed" }
is-it-maintained-issue-resolution = { repository = "google/rust_icu" }
is-it-maintained-open-issues = { repository = "google/rust_icu" }
travis-ci = { repository = "google/rust_icu", branch = "master" }
1 change: 1 addition & 0 deletions rust_icu_unum/README.md
29 changes: 29 additions & 0 deletions rust_icu_unum/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! # ICU number formatting support for rust
//!
//! Since 0.3.1
use {
rust_icu_common as common, rust_icu_sys as sys,
rust_icu_sys::versioned_function,
rust_icu_sys::*,
rust_icu_ustring as ustring,
std::{convert::TryFrom, os::raw, ffi, ptr},
};

#[cfg(test)]
mod tests {
}

0 comments on commit 3076e55

Please sign in to comment.