Giter Site home page Giter Site logo

tuple's Introduction

tuple

Element wise operations on tuples!

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

tuple's People

Contributors

insideoutclub avatar s3bk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

insideoutclub

tuple's Issues

Missing license

Hi, You might want to include a LICENSE file in your repo stating what license you distribute your code under, otherwise lots of potential users will not depend the crate due to legal grey area.

Implement the `Hash` trait for `Tn` structs

I just discovered this crate and wanted to integrate it into my Advent of Code solutions, but was met with this error:

error[E0277]: the trait bound `T2<usize, usize>: Hash` is not satisfied
    --> src\y2023\day11.rs:33:10
     |
33   |         .collect()
     |          ^^^^^^^ the trait `Hash` is not implemented for `T2<usize, usize>`
     |
     = help: the trait `FromIterator<T>` is implemented for `HashSet<T, S>`
     = note: required for `HashSet<T2<usize, usize>>` to implement `FromIterator<T2<usize, usize>>`
note: required by a bound in `collect`
    --> C:\Users\thoma\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\iter\traits\iterator.rs:2050:19
     |
2050 |     fn collect<B: FromIterator<Self::Item>>(self) -> B
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`

For more information about this error, try `rustc --explain E0277`.

Is there a technical limitation that prevents this crate from implementing the Hash trait when the contained types already implement Hash?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.