heh
impl Λ for string
bendn 2023-12-13
parent ae38330 · commit 69ab360
-rw-r--r--src/util.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs
index 0e07bc7..a1ac6a8 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -89,6 +89,15 @@ pub trait Λ {
<T as FromStr>::Err: std::fmt::Display;
}
+impl Λ for String {
+ fn λ<T: FromStr>(&self) -> T
+ where
+ <T as FromStr>::Err: std::fmt::Display,
+ {
+ self.as_str().λ()
+ }
+}
+
impl Λ for &str {
/// parse, unwrap
fn λ<T: FromStr>(&self) -> T