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

#187 in Encoding

Download history 4284/week @ 2024-07-21 4069/week @ 2024-07-28 4774/week @ 2024-08-04 4669/week @ 2024-08-11 5038/week @ 2024-08-18 6060/week @ 2024-08-25 6351/week @ 2024-09-01 5572/week @ 2024-09-08 6820/week @ 2024-09-15 7158/week @ 2024-09-22 5070/week @ 2024-09-29 7009/week @ 2024-10-06 6774/week @ 2024-10-13 6541/week @ 2024-10-20 7356/week @ 2024-10-27 7072/week @ 2024-11-03

28,185 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

~205KB