13202 shaares
347 private links
347 private links
It seems Rust is built for Parse, don't validate. The invariants are encoded in the type system.
- https://docs.rs/nonempty/latest/nonempty/ crates ensure
.first()always return - AbsPathBug is useful because Subsequent code doesn't have to validate the the path is absolute. The type enforces it.
NonZeroensure the 0 value doesn't exist on the number type. Rust cam also optimize the memory used forOption<NonZero>by using the zero value asNone.