#tuple #science

tuple

Element-wise operations on tuples

24 releases

Uses old Rust 2015

0.5.1 Oct 7, 2020
0.4.2 Nov 14, 2018
0.4.0 Jun 4, 2018
0.3.5 Oct 27, 2017
0.1.5 Mar 31, 2017

#725 in Rust patterns

Download history 2427/week @ 2022-08-15 1782/week @ 2022-08-22 2105/week @ 2022-08-29 3345/week @ 2022-09-05 1927/week @ 2022-09-12 1965/week @ 2022-09-19 2195/week @ 2022-09-26 2443/week @ 2022-10-03 1893/week @ 2022-10-10 1090/week @ 2022-10-17 3104/week @ 2022-10-24 2478/week @ 2022-10-31 2499/week @ 2022-11-07 3563/week @ 2022-11-14 2411/week @ 2022-11-21 2573/week @ 2022-11-28

11,106 downloads per month
Used in 10 crates (6 directly)

MIT license

43KB
884 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

~245KB