-
Notifications
You must be signed in to change notification settings - Fork 5
Impl pretty-printing for AugmentedScriptSet #19
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
Conversation
src/mixed_script.rs
Outdated
impl Debug for AugmentedScriptSet { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
if self.is_empty() { | ||
write!(f, "AugmentedScriptSet{{∅}}")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a space after the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
src/mixed_script.rs
Outdated
let hanb = if self.hanb { Some("Hanb") } else { None }; | ||
let jpan = if self.jpan { Some("Jpan") } else { None }; | ||
let kore = if self.kore { Some("Kore") } else { None }; | ||
for writing_system in None.into_iter().chain(hanb).chain(jpan).chain(kore) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can just chain an base.iter.map(Script::short_name)
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! Thanks
src/mixed_script.rs
Outdated
//for script in self.hanb | ||
write!(f, "}}")?; | ||
} | ||
//if self.base.is_common() || self.base.is_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
src/restriction_level.rs
Outdated
@@ -58,13 +58,21 @@ impl RestrictionLevelDetection for &'_ str { | |||
} | |||
} | |||
|
|||
fn single_item<I: Iterator>(mut iter: I) -> Option<I::Item> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we instead implement this via count_ones()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean accessing the bitset underlying ScriptExtension
directly? We cannot access the implementation detail from this crate...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, add that to the original crate. Maybe a len()
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is merged, now we need a new release of that crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/mixed_script.rs
Outdated
@@ -67,14 +65,50 @@ impl From<&'_ str> for AugmentedScriptSet { | |||
impl Default for AugmentedScriptSet { | |||
fn default() -> Self { | |||
AugmentedScriptSet { | |||
base: ScriptExtension::Single(Script::Common), | |||
base: ScriptExtension::from(Script::Common), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I prefer .into()
Rebased and addressed the review comments. |
No description provided.