Skip to content

Replace finl_unicode with unicode-properties #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ repository = "https://github.com/sfackler/rust-stringprep"
readme = "README.md"

[dependencies]
finl_unicode = "1.2.0"
unicode-bidi = "0.3"
unicode-normalization = "0.1"
unicode-properties = "0.1.1"
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//!
//! [RFC 3454]: https://tools.ietf.org/html/rfc3454
#![warn(missing_docs)]
extern crate finl_unicode;
extern crate unicode_bidi;
extern crate unicode_normalization;
extern crate unicode_properties;

use finl_unicode::categories::CharacterCategories;
use std::borrow::Cow;
use std::fmt;
use unicode_normalization::UnicodeNormalization;
use unicode_properties::{GeneralCategoryGroup, UnicodeGeneralCategory};

mod rfc3454;
pub mod tables;
Expand Down Expand Up @@ -353,7 +353,7 @@ pub fn x520prep(s: &str, case_fold: bool) -> Result<Cow<'_, str>, Error> {
// "The first code point of a string is prohibited from being a combining character."
match s.chars().next() {
Some(c) => {
if c.is_mark() {
if c.general_category_group() == GeneralCategoryGroup::Mark {
return Err(Error(ErrorCause::StartsWithCombiningCharacter));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/tables.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Character Tables
use finl_unicode::categories::CharacterCategories;
use std::cmp::Ordering;
use std::str::Chars;
use unicode_bidi::{bidi_class, BidiClass};
use unicode_properties::{GeneralCategoryGroup, UnicodeGeneralCategory};

use super::rfc3454;

Expand Down Expand Up @@ -246,6 +246,6 @@ pub fn x520_mapped_to_nothing(c: char) -> bool {
pub fn x520_mapped_to_space(c: char) -> bool {
match c {
'\u{09}' | '\u{0A}'..='\u{0D}' | '\u{85}' => true,
_ => c.is_separator(),
_ => c.general_category_group() == GeneralCategoryGroup::Separator,
}
}
Loading