| Crates.io | tuple-traits |
| lib.rs | tuple-traits |
| version | 0.1.1 |
| created_at | 2024-11-11 09:23:46.584904+00 |
| updated_at | 2024-11-11 10:03:48.668165+00 |
| description | Additional tuple traits to enable ergonomic types. |
| homepage | |
| repository | https://github.com/andogq/tuple-traits |
| max_upload_size | |
| id | 1443614 |
| size | 15,163 |
AppendAppend a type to a tuple.
static_assertions::assert_type_eq_all!(
<(usize, char) as tuple_traits::Append>::Append<bool>,
(usize, char, bool)
);
ConsRepresent a tuple as a cons (ish) value, with the first value on the left, and the rest of the tuple on the right.
static_assertions::assert_impl_all!(
(usize, usize, usize): tuple_traits::Cons<Left = usize, Right = (usize, usize)>
);
ContainsA trait that will only be implement for a given target if it is present within a given type.
struct A;
struct B;
struct C;
fn requires_c<T, Index>(value: T)
where
T: tuple_traits::Contains<C, Index>
{
}
// Works!
requires_c((A, B, C));
// Compiler error: `C` does not appear within `(A, B)`
// requires_c((A, B));
Check out ./examples/buffer-flags.rs for a full example!