From 9f1c88b863e247da3cd60d2792a7a13b18e25e53 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Wed, 14 Dec 2022 23:48:22 +0800 Subject: a temporary check point just to save things in a commit --- receme/src/functor.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'receme/src') diff --git a/receme/src/functor.rs b/receme/src/functor.rs index 95e2555..cd4dac2 100644 --- a/receme/src/functor.rs +++ b/receme/src/functor.rs @@ -31,6 +31,14 @@ pub trait Functor { fn fmap(self, f: impl FnMut(T) -> S) -> Self::Target; } +impl Functor for Vec { + type Target = Vec; + + fn fmap(self, f: impl FnMut(T) -> S) -> Self::Target { + self.into_iter().map(f).collect() + } +} + /// A functor can map over its generic type parameter. /// /// It can map from Functor(T) to Functor(S). -- cgit v1.2.3-18-g5258