summaryrefslogtreecommitdiff
path: root/src/model/cast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/cast.rs')
-rw-r--r--src/model/cast.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/model/cast.rs b/src/model/cast.rs
index 17ed2d30..0da9906f 100644
--- a/src/model/cast.rs
+++ b/src/model/cast.rs
@@ -233,6 +233,17 @@ castable! {
}
castable! {
+ char,
+ string: Str => {
+ let mut chars = string.chars();
+ match (chars.next(), chars.next()) {
+ (Some(c), None) => c,
+ _ => Err("expected exactly one character")?,
+ }
+ },
+}
+
+castable! {
EcoString,
string: Str => string.into(),
}