Skip to content

Implement detect restriction level #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
Jan 2, 2020

Conversation

crlf0710
Copy link
Collaborator

@crlf0710 crlf0710 commented Jan 1, 2020

This is a draft implementation. I implemented the algorithm itself, however there's a Recommended script concept which is defined in TR31. For now this is_recommended() method is not defined.

@Manishearth
Copy link
Member

I'd have the API take a RestrictionLevel and return bool instead

@crlf0710
Copy link
Collaborator Author

crlf0710 commented Jan 2, 2020

OK. And where should we implement the is_recommended() API? Should we add it to unicode-script?

if !GeneralSecurityProfile::identifier_allowed(ch) {
return RestrictionLevel::Unrestricted;
}
if ch as u32 > 0x7F {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's an is_ascii method

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

let ch_set = ch.into();
set = set.intersect(ch_set);
if !ch_set.base.contains_script(Script::Latin) {
exclude_latin_set.intersect(ch_set);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intersect() does not mutate.

Perhaps we should have an intersection() and intersect_with() pair of methods on unicode-script

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

@Manishearth
Copy link
Member

Yes, please add it to unicode-script. While you're at it can you split the public intersect() method into a self -> Self intersection() and a &mut self intersect() or intersect_with()?

@crlf0710
Copy link
Collaborator Author

crlf0710 commented Jan 2, 2020

ok. I'll create a branch and PR when i return from work today.

@Manishearth Manishearth force-pushed the draft_detect_restriction_level branch from fd51b23 to b80d8f1 Compare January 2, 2020 03:20
@Manishearth
Copy link
Member

I made the changes upstream.

@Manishearth Manishearth marked this pull request as ready for review January 2, 2020 03:21
@Manishearth Manishearth merged commit dca4718 into master Jan 2, 2020
@Manishearth Manishearth deleted the draft_detect_restriction_level branch January 2, 2020 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy