25 releases

Uses old Rust 2015

0.5.2 Dec 11, 2023
0.5.1 Oct 7, 2020
0.5.0 Sep 12, 2020
0.4.2 Nov 14, 2018
0.1.5 Mar 31, 2017

#185 in Encoding

Download history 4822/week @ 2024-08-06 4455/week @ 2024-08-13 5499/week @ 2024-08-20 5653/week @ 2024-08-27 6678/week @ 2024-09-03 6029/week @ 2024-09-10 6582/week @ 2024-09-17 6940/week @ 2024-09-24 5526/week @ 2024-10-01 6285/week @ 2024-10-08 7175/week @ 2024-10-15 6478/week @ 2024-10-22 7516/week @ 2024-10-29 6432/week @ 2024-11-05 5513/week @ 2024-11-12 5275/week @ 2024-11-19

25,866 downloads per month
Used in 32 crates (12 directly)

MIT license

43KB
902 lines

tuple

Element wise operations on tuples!

Documentation

This crate allows to generalize operations to tuples using macros. Please look at the Documentation for examples.

Features

  • impl_num (default) add support for (some) num traits
  • impl_serde (default) add support for serialization and deserialization (depends on serde)
  • impl_simd add support for (some) simd-types (depends on stdsimd and is only available on nightly)

Supported Operations

  • TupleElements trait (for tuples where all elements have the same type)
    • get and get_mut functions
    • N (number of elements)
  • ops
    • Index,IndexMut
    • Clone, Copy
    • Add, AddAssign
    • Sub, SubAssign
    • Mul, Div
    • Neg
  • fmt::Debug
  • iter
    • Iterator Iterate over all elements at once (assuming they implement Iterator). The iterations stops once one or more elements return None.
  • convert
    • From and Into their tuple equivalent.
    • From and Into their array equivalent.
    • TryFrom slice
  • Map<T> trait
    • map: apply a function to each element and return the resulting tuple
  • other
    • rev: reverse the elements
    • rot_l and rot_r: rotate elements
    • split: make two separate tuples out of one
    • join: turn two tuples into one

Dependencies

~195KB