Skip to content

Commit

Permalink
[doc] TryFromBytes, IntoBytes aren't symmetrical (#860)
Browse files Browse the repository at this point in the history
Makes progress on #5
  • Loading branch information
joshlf committed Feb 12, 2024
1 parent 65f2e3e commit eba9dd2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,16 @@ pub unsafe trait NoCell {
/// If you are negatively affected by lack of support for a particular type,
/// we encourage you to let us know by [filing an issue][github-repo].
///
/// # `TryFromBytes` is not symmetrical with [`IntoBytes`]
///
/// There are some types which implement both `TryFromBytes` and [`IntoBytes`],
/// but for which `TryFromBytes` is not guaranteed to accept all byte sequences
/// produced by `IntoBytes`. In other words, for some `T: TryFromBytes +
/// IntoBytes`, there exist values of `t: T` such that
/// `TryFromBytes::try_from_ref(t.as_bytes()) == None`. Code should not
/// generally assume that values produced by `IntoBytes` will necessarily be
/// accepted as valid by `TryFromBytes`.
///
/// # Safety
///
/// On its own, `T: TryFromBytes` does not make any guarantees about the layout
Expand Down

0 comments on commit eba9dd2

Please sign in to comment.