mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-06 01:02:55 +00:00
20 lines
450 B
Rust
20 lines
450 B
Rust
use std::ops::Range;
|
|
|
|
pub trait Iterable<T = u64> {
|
|
fn boxed_iter(&self) -> Box<dyn Iterator<Item = T> + '_>;
|
|
}
|
|
|
|
impl<'a, T: Copy> Iterable<T> for &'a [T] {
|
|
fn boxed_iter(&self) -> Box<dyn Iterator<Item = T> + '_> {
|
|
Box::new(self.iter().copied())
|
|
}
|
|
}
|
|
|
|
impl<T: Copy> Iterable<T> for Range<T>
|
|
where Range<T>: Iterator<Item = T>
|
|
{
|
|
fn boxed_iter(&self) -> Box<dyn Iterator<Item = T> + '_> {
|
|
Box::new(self.clone())
|
|
}
|
|
}
|