summaryrefslogtreecommitdiff
path: root/src/eval/str.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-07 15:17:13 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-07 15:17:13 +0100
commit25b5bd117529cd04bb789e1988eb3a3db8025a0e (patch)
tree2fbb4650903123da047a1f1f11a0abda95286e12 /src/eval/str.rs
parent6ab7760822ccd24b4ef126d4737d41f1be15fe19 (diff)
Fully untyped model
Diffstat (limited to 'src/eval/str.rs')
-rw-r--r--src/eval/str.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/eval/str.rs b/src/eval/str.rs
index 63ea5dc8..0d5d71b9 100644
--- a/src/eval/str.rs
+++ b/src/eval/str.rs
@@ -6,7 +6,7 @@ use std::ops::{Add, AddAssign, Deref};
use ecow::EcoString;
use unicode_segmentation::UnicodeSegmentation;
-use super::{castable, dict, Array, Dict, Value};
+use super::{cast_from_value, dict, Array, Dict, Value};
use crate::diag::StrResult;
use crate::geom::GenAlign;
@@ -479,6 +479,10 @@ impl Hash for Regex {
}
}
+cast_from_value! {
+ Regex: "regular expression",
+}
+
/// A pattern which can be searched for in a string.
#[derive(Debug, Clone)]
pub enum StrPattern {
@@ -488,7 +492,7 @@ pub enum StrPattern {
Regex(Regex),
}
-castable! {
+cast_from_value! {
StrPattern,
text: Str => Self::Str(text),
regex: Regex => Self::Regex(regex),
@@ -504,7 +508,7 @@ pub enum StrSide {
End,
}
-castable! {
+cast_from_value! {
StrSide,
align: GenAlign => match align {
GenAlign::Start => Self::Start,