mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
Implement IntoCharIter for &[char]
This commit is contained in:
parent
a91689e211
commit
6b687adb40
1 changed files with 10 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue