8000 Add From impls · unicode-rs/unicode-script@d32d1e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit d32d1e3

Browse files
committed
Add From impls
1 parent 2ac1251 commit d32d1e3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ impl Script {
2222
}
2323
}
2424

25+
impl From<char> for Script {
26+
fn from(o: char) -> Self {
27+
o.script()
28+
}
29+
}
30+
2531
impl ScriptExtension {
2632
/// Obtain the list of scripts contained inside this ScriptExtension
2733
#[cfg(feature = "with_std")]
@@ -46,6 +52,12 @@ impl ScriptExtension {
4652
}
4753
}
4854

55+
impl From<char> for ScriptExtension {
56+
fn from(o: char) -> Self {
57+
o.script_extension()
58+
}
59+
}
60+
4961
/// Extension trait on `char` for calculating script properties
5062
pub trait UnicodeScript {
5163
/// Get the script for a given character

0 commit comments

Comments
 (0)
0