summaryrefslogtreecommitdiffstats
path: root/third_party/rust/icu_segmenter/src/iterator_helpers.rs
blob: 593a4702ca0085a1bf9e7c4e8e9eb9fe8d52672f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

//! Macros and utilities to help implement the various iterator types.

macro_rules! derive_usize_iterator_with_type {
    ($ty:tt) => {
        impl<'l, 's, Y: RuleBreakType<'l, 's> + ?Sized> Iterator for $ty<'l, 's, Y> {
            type Item = usize;
            #[inline]
            fn next(&mut self) -> Option<Self::Item> {
                self.0.next()
            }
        }
    };
}

pub(crate) use derive_usize_iterator_with_type;