Skip to content

Commit

Permalink
Add caveats to README.md (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunjhongwu authored Mar 4, 2024
1 parent 3f0a3b2 commit ebaeabb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ println!("{}", timestamp); // Timestamp(1701620628123456789)
- Adding the following attributes to `#[strong_type(...)]` allows for additional features:
- `auto_operators`: Automatically implements relevant arithmetic (for numeric types) or logical (for boolean types) operators.
- `custom_display`: Allows users to manually implement the `Display` trait, providing an alternative to the default display format.
- `conversion`: Automatically implements `From` and `Into` traits for the underlying type.
- `conversion`: Automatically implements `From` and `Into` traits for the underlying type. This is optional since conversion may make strong types less distinct.
- `underlying`: Specifies the underlying primitive type for nested strong types.

## Installation
Expand Down Expand Up @@ -163,3 +163,7 @@ struct Cash(Dollar);
#[strong_type(underlying = i32)]
struct Coin(Cash);
```

### Caveats:
- When using `#[derive(StrongType)]`, the traits `Eq` and `PartialEq` are implemented with `impl`.
As a result, `StructuralEq` and `StructuralPartialEq` remain unimplemented, preventing pattern matching with strong-typed primitives.

0 comments on commit ebaeabb

Please sign in to comment.