Skip to content

Commit

Permalink
[wip]
Browse files Browse the repository at this point in the history
  • Loading branch information
jswrenn committed May 15, 2024
1 parent 4a74df2 commit 3a0f747
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,9 @@ pub unsafe trait TryFromBytes {
/// copying.
///
/// If the bytes of `candidate` are a valid instance of `Self`, this method
/// returns a reference to those bytes interpreted as a `Self`. If
/// `candidate.len() < size_of::<Self>()` or `candidate` is not aligned to
/// `align_of::<Self>()` or the bytes are not a valid instance of `Self`,
/// this returns `Err`.
/// returns a reference to those bytes interpreted as a `Self`. If there are
/// insufficient bytes, or if `candidate` is not appropriately aligned, or
/// if the bytes are not a valid instance of `Self`, this returns `Err`.
///
/// # Compile-Time Assertions
///
Expand Down Expand Up @@ -1201,13 +1200,14 @@ pub unsafe trait TryFromBytes {

/// Attempts to interpret the prefix of the given `candidate` as a `&Self`
/// without copying.
///
/// If the first `size_of::<Self>()` bytes of `candidate` are a valid
/// instance of `Self`, this method returns both a reference to those bytes
/// interpreted as a `Self`, and a reference to the remaining bytes. If
/// `candidate.len() < size_of::<Self>()` or `candidate` is not aligned to
/// `align_of::<Self>()` or the bytes are not a valid instance of `Self`,
/// this returns `Err`.
///
/// This method attempts to deserialize the largest possible size of `Self`
/// from the leading bytes of `candidate`. If that prefix is a valid
/// instance of `Self`, this method returns a reference to those bytes
/// reinterpreted as `Self`, and a reference to the remaining bytes. If
/// there are insufficient bytes, or if `candidate` is not appropriately
/// aligned, or if the bytes are not a valid instance of `Self`, this
/// returns `Err`.
///
/// # Compile-Time Assertions
///
Expand Down Expand Up @@ -1281,12 +1281,13 @@ pub unsafe trait TryFromBytes {
/// Attempts to interpret the suffix of the given `candidate` as a `&Self`
/// without copying.
///
/// If the last `size_of::<Self>()` bytes of `candidate` are a valid
/// instance of `Self`, this method returns both a reference to those bytes
/// interpreted as a `Self`, and a reference to the preceding bytes. If
/// `candidate.len() < size_of::<Self>()` or the suffix of `candidate` is
/// not aligned to `align_of::<Self>()` or the suffix of `candidate` is not
/// a valid instance of `Self`, this returns `Err`.
/// This method attempts to deserialize the largest possible size of `Self`
/// from the trailing bytes of `candidate`. If that suffix is a valid
/// instance of `Self`, this method returns a reference to those bytes
/// reinterpreted as `Self`, and a reference to the preceeding bytes. If
/// there are insufficient bytes, or if the suffix of `candidate` would not
/// be appropriately aligned, or if the suffix is not a valid instance of
/// `Self`, this returns `Err`.
///
/// # Compile-Time Assertions
///
Expand Down

0 comments on commit 3a0f747

Please sign in to comment.