From 6b687adb40f56ba1c78b39f9295680c21b7a41b1 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Sun, 19 Mar 2023 16:54:07 +0100 Subject: [PATCH] Implement IntoCharIter for &[char] --- fish-rust/src/wchar_ext.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fish-rust/src/wchar_ext.rs b/fish-rust/src/wchar_ext.rs index 7f7633f1c..f50ae8a45 100644 --- a/fish-rust/src/wchar_ext.rs +++ b/fish-rust/src/wchar_ext.rs @@ -1,3 +1,5 @@ +use std::{iter, slice}; + use crate::wchar::{wstr, WString}; use widestring::utfstr::CharsUtf32; @@ -102,6 +104,14 @@ impl<'a> IntoCharIter for &'a str { } } +impl<'a> IntoCharIter for &'a [char] { + type Iter = iter::Copied>; + + fn chars(self) -> Self::Iter { + self.iter().copied() + } +} + impl<'a> IntoCharIter for &'a wstr { type Iter = CharsUtf32<'a>; fn chars(self) -> Self::Iter {