You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-11 16:50:16 +02:00
Avoid incorrect attribution to the borrow-checker
This commit is contained in:
@ -44,8 +44,9 @@ impl Username {
|
||||
ensuring that all instances of `Username` satisfy those checks.
|
||||
|
||||
- The `as_str` method allows consumers to access the raw string representation
|
||||
(e.g., to store it in a database) but, thanks to Rust's borrow checker, they
|
||||
can't modify it.
|
||||
(e.g., to store it in a database). However, consumers can't modify the
|
||||
underlying value since `&str`, the returned type, restricts them to read-only
|
||||
access.
|
||||
|
||||
- Stress the importance of evaluating _the entire API surface_ exposed by a
|
||||
newtype to determine if invariants are indeed bullet-proof.
|
||||
|
Reference in New Issue
Block a user