#tuple #science

tuple

Element-wise operations on tuples

23 releases

Uses old Rust 2015

0.5.0 Sep 12, 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

#40 in Science

Download history 100/week @ 2020-05-30 53/week @ 2020-06-06 57/week @ 2020-06-13 56/week @ 2020-06-20 74/week @ 2020-06-27 73/week @ 2020-07-04 79/week @ 2020-07-11 79/week @ 2020-07-18 85/week @ 2020-07-25 89/week @ 2020-08-01 155/week @ 2020-08-08 82/week @ 2020-08-15 81/week @ 2020-08-22 121/week @ 2020-08-29 137/week @ 2020-09-05 78/week @ 2020-09-12

388 downloads per month
Used in 9 crates (6 directly)

MIT license

40KB
829 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

~250KB