Skip to content

Commit 28097f3

Browse files
Avoid repetition across slides
1 parent 3c19ca0 commit 28097f3

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

src/idiomatic/leveraging-the-type-system/newtype-pattern/is-it-encapsulated.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ minutes: 5
44

55
# Is It Truly Encapsulated?
66

7-
You must evaluate the entire API surface exposed by a newtype to determine if
7+
You must evaluate _the entire API surface_ exposed by a newtype to determine if
88
invariants are indeed bullet-proof. It is crucial to consider all possible
99
interactions, including trait implementations, that may allow users to bypass
1010
validation checks.

src/idiomatic/leveraging-the-type-system/newtype-pattern/parse-don-t-validate.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ impl Username {
4848
underlying value since `&str`, the returned type, restricts them to read-only
4949
access.
5050

51-
- Stress the importance of evaluating _the entire API surface_ exposed by a
52-
newtype to determine if invariants are indeed bullet-proof.
53-
54-
It is crucial to consider all possible interactions, including trait
55-
implementations, that may allow users to bypass the invariants. For example,
56-
if the `Username` type implements the `DerefMut` trait, users can modify the
57-
underlying string directly, bypassing the validation checks in `new`.
58-
5951
- Type-level invariants have second-order benefits.
6052

6153
The input is validated once, at the boundary, and the rest of the program can

0 commit comments

Comments
 (0)