From: Ian Jackson Date: Sat, 27 Feb 2021 11:18:53 +0000 (+0000) Subject: Provide PosC::try_map X-Git-Tag: otter-0.4.0~322 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4d69763061be0df292296f68a021bb9aa24e5157;p=otter.git Provide PosC::try_map Signed-off-by: Ian Jackson --- diff --git a/src/spec.rs b/src/spec.rs index 5efe3f70..89f3e18d 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -309,6 +309,16 @@ pub mod pos_traits { } } + impl PosC { + pub fn try_map Result> + (self, f: F) -> Result,E> + { + PosC::try_from_iter_2( + self.0.iter().cloned().map(f) + ) + } + } + impl PosC { pub fn promote(&self) -> PosC { self.map(|v| v as f64) } }