heh
Diffstat (limited to 'src/util.rs')
| -rw-r--r-- | src/util.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/util.rs b/src/util.rs index b94d249..9c815eb 100644 --- a/src/util.rs +++ b/src/util.rs @@ -18,11 +18,13 @@ pub mod prelude { #[allow(unused_imports)] pub(crate) use super::{bits, dang, leek, mat, shucks, C}; pub use super::{ - even, gcd, gt, l, lcm, lt, nail, pa, r, rand, reading, reading::Ext, sort, DigiCount, Dir, - FilterBy, FilterBy3, GreekTools, IntoCombinations, IntoLines, IterͶ, NumTupleIterTools, - ParseIter, Printable, Skip, SplitU8, Str, TakeLine, TupleIterTools2, TupleIterTools2R, - TupleIterTools3, TupleUtils, UnifiedTupleUtils, UnsoundUtilities, Widen, Ͷ, Α, Κ, Λ, Μ, + even, gcd, gt, l, lcm, lt, nail, pa, r, rand, reading, reading::Ext, sort, twice, + DigiCount, Dir, FilterBy, FilterBy3, GreekTools, IntoCombinations, IntoLines, IterͶ, + NumTupleIterTools, ParseIter, Printable, Skip, SplitU8, Str, TakeLine, TupleIterTools2, + TupleIterTools2R, TupleIterTools3, TupleUtils, UnifiedTupleUtils, UnsoundUtilities, Widen, + Ͷ, Α, Κ, Λ, Μ, }; + pub use itertools::iproduct; pub use itertools::izip; pub use itertools::Itertools; pub use rustc_hash::FxHashMap as HashMap; @@ -1815,3 +1817,6 @@ pub fn nb(x: usize, y: usize) -> [(usize, usize); 8] { (x + 1, y + 1), ] } +pub fn twice<T: Copy>(x: T) -> impl Iterator<Item = T> + Clone + ExactSizeIterator { + std::iter::repeat_n(x, 2) +} |