Skip to content

Commit

Permalink
fix #274 (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-hoffman authored Oct 10, 2024
1 parent 48952a0 commit 1c09edf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions src/checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ pub fn try_pod_read_unaligned<T: CheckedBitPattern>(
}
}

/// Try to cast `T` into `U`.
/// Try to cast `A` into `B`.
///
/// Note that for this particular type of cast, alignment isn't a factor. The
/// input value is semantically copied into the function and then returned to a
Expand All @@ -316,7 +316,7 @@ pub fn try_cast<A: NoUninit, B: CheckedBitPattern>(
}
}

/// Try to convert a `&T` into `&U`.
/// Try to convert a `&A` into `&B`.
///
/// ## Failure
///
Expand All @@ -336,7 +336,7 @@ pub fn try_cast_ref<A: NoUninit, B: CheckedBitPattern>(
}
}

/// Try to convert a `&mut T` into `&mut U`.
/// Try to convert a `&mut A` into `&mut B`.
///
/// As [`try_cast_ref`], but `mut`.
#[inline]
Expand Down Expand Up @@ -445,7 +445,7 @@ pub fn pod_read_unaligned<T: CheckedBitPattern>(bytes: &[u8]) -> T {
}
}

/// Cast `T` into `U`
/// Cast `A` into `B`
///
/// ## Panics
///
Expand All @@ -458,7 +458,7 @@ pub fn cast<A: NoUninit, B: CheckedBitPattern>(a: A) -> B {
}
}

/// Cast `&mut T` into `&mut U`.
/// Cast `&mut A` into `&mut B`.
///
/// ## Panics
///
Expand All @@ -476,7 +476,7 @@ pub fn cast_mut<
}
}

/// Cast `&T` into `&U`.
/// Cast `&A` into `&B`.
///
/// ## Panics
///
Expand All @@ -502,7 +502,7 @@ pub fn cast_slice<A: NoUninit, B: CheckedBitPattern>(a: &[A]) -> &[B] {
}
}

/// Cast `&mut [T]` into `&mut [U]`.
/// Cast `&mut [A]` into `&mut [B]`.
///
/// ## Panics
///
Expand Down
14 changes: 7 additions & 7 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub(crate) unsafe fn try_from_bytes_mut<T: Copy>(
}
}

/// Cast `T` into `U`
/// Cast `A` into `B`
///
/// ## Panics
///
Expand All @@ -194,7 +194,7 @@ pub(crate) unsafe fn cast<A: Copy, B: Copy>(a: A) -> B {
}
}

/// Cast `&mut T` into `&mut U`.
/// Cast `&mut A` into `&mut B`.
///
/// ## Panics
///
Expand All @@ -215,7 +215,7 @@ pub(crate) unsafe fn cast_mut<A: Copy, B: Copy>(a: &mut A) -> &mut B {
}
}

/// Cast `&T` into `&U`.
/// Cast `&A` into `&B`.
///
/// ## Panics
///
Expand Down Expand Up @@ -249,7 +249,7 @@ pub(crate) unsafe fn cast_slice<A: Copy, B: Copy>(a: &[A]) -> &[B] {
}
}

/// Cast `&mut [T]` into `&mut [U]`.
/// Cast `&mut [A]` into `&mut [B]`.
///
/// ## Panics
///
Expand All @@ -262,7 +262,7 @@ pub(crate) unsafe fn cast_slice_mut<A: Copy, B: Copy>(a: &mut [A]) -> &mut [B] {
}
}

/// Try to cast `T` into `U`.
/// Try to cast `A` into `B`.
///
/// Note that for this particular type of cast, alignment isn't a factor. The
/// input value is semantically copied into the function and then returned to a
Expand All @@ -283,7 +283,7 @@ pub(crate) unsafe fn try_cast<A: Copy, B: Copy>(
}
}

/// Try to convert a `&T` into `&U`.
/// Try to convert a `&A` into `&B`.
///
/// ## Failure
///
Expand All @@ -306,7 +306,7 @@ pub(crate) unsafe fn try_cast_ref<A: Copy, B: Copy>(
}
}

/// Try to convert a `&mut T` into `&mut U`.
/// Try to convert a `&mut A` into `&mut B`.
///
/// As [`try_cast_ref`], but `mut`.
#[inline]
Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ pub fn try_from_bytes_mut<T: NoUninit + AnyBitPattern>(
unsafe { internal::try_from_bytes_mut(s) }
}

/// Cast `T` into `U`
/// Cast `A` into `B`
///
/// ## Panics
///
Expand All @@ -336,7 +336,7 @@ pub fn cast<A: NoUninit, B: AnyBitPattern>(a: A) -> B {
unsafe { internal::cast(a) }
}

/// Cast `&mut T` into `&mut U`.
/// Cast `&mut A` into `&mut B`.
///
/// ## Panics
///
Expand All @@ -348,7 +348,7 @@ pub fn cast_mut<A: NoUninit + AnyBitPattern, B: NoUninit + AnyBitPattern>(
unsafe { internal::cast_mut(a) }
}

/// Cast `&T` into `&U`.
/// Cast `&A` into `&B`.
///
/// ## Panics
///
Expand All @@ -368,7 +368,7 @@ pub fn cast_slice<A: NoUninit, B: AnyBitPattern>(a: &[A]) -> &[B] {
unsafe { internal::cast_slice(a) }
}

/// Cast `&mut [T]` into `&mut [U]`.
/// Cast `&mut [A]` into `&mut [B]`.
///
/// ## Panics
///
Expand Down Expand Up @@ -404,7 +404,7 @@ pub fn pod_align_to_mut<
unsafe { vals.align_to_mut::<U>() }
}

/// Try to cast `T` into `U`.
/// Try to cast `A` into `B`.
///
/// Note that for this particular type of cast, alignment isn't a factor. The
/// input value is semantically copied into the function and then returned to a
Expand All @@ -421,7 +421,7 @@ pub fn try_cast<A: NoUninit, B: AnyBitPattern>(
unsafe { internal::try_cast(a) }
}

/// Try to convert a `&T` into `&U`.
/// Try to convert a `&A` into `&B`.
///
/// ## Failure
///
Expand All @@ -434,7 +434,7 @@ pub fn try_cast_ref<A: NoUninit, B: AnyBitPattern>(
unsafe { internal::try_cast_ref(a) }
}

/// Try to convert a `&mut T` into `&mut U`.
/// Try to convert a `&mut A` into `&mut B`.
///
/// As [`try_cast_ref`], but `mut`.
#[inline]
Expand Down

0 comments on commit 1c09edf

Please sign in to comment.