### 2 releases

0.1.1 | Jun 21, 2020 |
---|---|

0.1.0 | Jun 21, 2020 |

**MIT/Apache**

7KB

# distinct

Two traits for enforcing that two types either must be the same or must be different.

## Usage

To use in your crate, add this to your

:`Cargo .toml`

`[``dependencies``]`
`distinct ``=` `"`0.1.1`"`

and add this where you want to use it:

`use` `distinct``::``{`Distinct`,` NonDistinct`}``;`

For full documentation on how to use it, consult this crate's documentation on docs.rs.

###
`lib.rs`

:

A pair of traits which can be used to ensure that two types either are distinct or are not distinct.

There are two traits:

and `Distinct`

. `NonDistinct`

is
implemented for tuples of two distinct types. `Distinct`

is
implemented for tuples of two of the same type.`NonDistinct`

# Examples

`use` `distinct``::``{`Distinct`,` NonDistinct`}``;`
`//` Two functions which enforce that the given type is distinct.
`fn` `assert_is_distinct``<`T`:` Distinct `+` `?``Sized``>``(``)` `{``}`
`fn` `assert_is_non_distinct``<`T`:` NonDistinct `+` `?``Sized``>``(``)` `{``}`
`assert_is_distinct``::``<``(``u32`, `u64``)``>``(``)``;`
`assert_is_non_distinct``::``<``(``u32`, `u32``)``>``(``)``;`