Skip to content

Commit 5192570

Browse files
committed
Add some more description of interactions between Display and FromStr
1 parent 6a09a85 commit 5192570

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/core/src/str/traits.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,10 @@ unsafe impl SliceIndex<str> for ops::RangeToInclusive<usize> {
761761
/// mistake, unless the type has provided and documented additional guarantees about its `Display`
762762
/// and `FromStr` implementations.
763763
///
764+
/// If a type happens to have a lossless `Display` implementation whose output is meant to be
765+
/// conveniently machine-parseable and not just meant for human consumption, then the type may wish
766+
/// to accept the same format in `FromStr`, and document that usage.
767+
///
764768
/// # Examples
765769
///
766770
/// Basic implementation of `FromStr` on an example `Point` type:

0 commit comments

Comments
 (0)