Implement IntoCharIter for &[char]

This commit is contained in:
Xiretza 2023-03-19 16:54:07 +01:00 committed by Johannes Altmanninger
parent a91689e211
commit 6b687adb40

View file

@ -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<slice::Iter<'a, char>>;
fn chars(self) -> Self::Iter {
self.iter().copied()
}
}
impl<'a> IntoCharIter for &'a wstr {
type Iter = CharsUtf32<'a>;
fn chars(self) -> Self::Iter {