Skip to content

Commit e91713c

Browse files
committed
Remove impls for empty tuple from README
The two impl's are very similar and do not add to the comparison.
1 parent eeced67 commit e91713c

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

README.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# typle
22

3-
The `typle` crate provides the ability to constrain generic arguments to tuples
4-
and supports manipulation of the tuple components.
3+
The `typle` crate provides the ability to constrain generic arguments to be
4+
tuples and supports manipulation of the tuple components.
55

66
For example, to define a function to zip a pair of tuples into a tuple of pairs:
77

@@ -20,7 +20,7 @@ The types `A` and `B` are generic but are constrained to be tuples. The tuples
2020
can have 0 to 12 components of any (sized) type, but both parameters must have the
2121
same length.
2222

23-
```
23+
```rust
2424
assert_eq!(
2525
zip(("LHR", "FCO", "ZRH"), (51.5, 41.8, 47.5)),
2626
(("LHR", 51.5), ("FCO", 41.8), ("ZRH", 47.5))
@@ -39,17 +39,12 @@ A common use of `typle` is to implement a trait for tuples of multiple lengths.
3939
Compared to using declarative macros, the `typle` code looks more Rust-like and
4040
provides simple access to individual components.
4141

42-
For example the `Hash` trait for tuples simply hashes each component of the
43-
tuple in order.
42+
For example the `Hash` implementation for tuples simply hashes each component of
43+
the tuple in order.
4444

4545
Using `typle` this can be written as:
4646

4747
```rust
48-
impl Hash for () {
49-
#[inline]
50-
fn hash<H: Hasher>(&self, _state: &mut H) {}
51-
}
52-
5348
#[typle(Tuple for 1..=12)]
5449
impl<T> Hash for T
5550
where
@@ -70,13 +65,6 @@ Compare this to the current implementation in the standard library:
7065

7166
```rust
7267
macro_rules! impl_hash_tuple {
73-
() => (
74-
impl Hash for () {
75-
#[inline]
76-
fn hash<H: Hasher>(&self, _state: &mut H) {}
77-
}
78-
);
79-
8068
( $($name:ident)+) => (
8169
impl<$($name: Hash),+> Hash for ($($name,)+) where last_type!($($name,)+): ?Sized {
8270
#[allow(non_snake_case)]
@@ -94,7 +82,6 @@ macro_rules! last_type {
9482
($a:ident, $($rest_a:ident,)+) => { last_type!($($rest_a,)+) };
9583
}
9684

97-
impl_hash_tuple! {}
9885
impl_hash_tuple! { T }
9986
impl_hash_tuple! { T B }
10087
impl_hash_tuple! { T B C }

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
//! {
254254
//! type State = TupleSequenceState3<T0, T1, T2>;
255255
//! type Output = (<T0>::Output, <T1>::Output, <T2>::Output);
256+
//!
256257
//! fn extract(&self, state: Option<Self::State>) -> Self::Output {
257258
//! let mut state = state.unwrap_or(Self::State::S0((), None));
258259
//! {

0 commit comments

Comments
 (0)