-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
specifically start using 'collect_trusted', apply done
- Loading branch information
Showing
9 changed files
with
237 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ pub mod buffer; | |
pub mod error; | ||
pub mod kernels; | ||
pub mod prelude; | ||
pub mod trusted_len; | ||
pub mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use crate::utils::TrustMyLength; | ||
use std::slice::Iter; | ||
|
||
/// An iterator of known, fixed size. | ||
/// A trait denoting Rusts' unstable [TrustedLen](https://doc.rust-lang.org/std/iter/trait.TrustedLen.html). | ||
/// This is re-defined here and implemented for some iterators until `std::iter::TrustedLen` | ||
/// is stabilized. | ||
/// *Implementation from Jorge Leitao on Arrow2 | ||
pub unsafe trait TrustedLen: Iterator {} | ||
|
||
unsafe impl<T> TrustedLen for Iter<'_, T> {} | ||
|
||
unsafe impl<B, I: TrustedLen, T: FnMut(I::Item) -> B> TrustedLen for std::iter::Map<I, T> {} | ||
|
||
unsafe impl<'a, I, T: 'a> TrustedLen for std::iter::Copied<I> | ||
where | ||
I: TrustedLen<Item = &'a T>, | ||
T: Copy, | ||
{ | ||
} | ||
|
||
unsafe impl<I> TrustedLen for std::iter::Enumerate<I> where I: TrustedLen {} | ||
|
||
unsafe impl<A, B> TrustedLen for std::iter::Zip<A, B> | ||
where | ||
A: TrustedLen, | ||
B: TrustedLen, | ||
{ | ||
} | ||
|
||
unsafe impl<T> TrustedLen for std::slice::Windows<'_, T> {} | ||
|
||
unsafe impl<A, B> TrustedLen for std::iter::Chain<A, B> | ||
where | ||
A: TrustedLen, | ||
B: TrustedLen<Item = A::Item>, | ||
{ | ||
} | ||
|
||
unsafe impl<T> TrustedLen for std::iter::Once<T> {} | ||
|
||
unsafe impl<T> TrustedLen for std::vec::IntoIter<T> {} | ||
|
||
unsafe impl<A: Clone> TrustedLen for std::iter::Repeat<A> {} | ||
unsafe impl<A, F: FnMut() -> A> TrustedLen for std::iter::RepeatWith<F> {} | ||
unsafe impl<A: TrustedLen> TrustedLen for std::iter::Take<A> {} | ||
|
||
unsafe impl<I: TrustedLen + DoubleEndedIterator> TrustedLen for std::iter::Rev<I> {} | ||
|
||
unsafe impl<I: Iterator<Item = J>, J> TrustedLen for TrustMyLength<I, J> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.