mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-25 00:02:22 +00:00
cargo fmt is a strict one
This commit is contained in:
parent
af3f4404df
commit
79143a6295
@ -44,9 +44,9 @@ pub fn try_cast_box<A: Pod, B: Pod>(input: Box<A>) -> Result<Box<B>, (PodCastErr
|
|||||||
/// turns it into a Box. In other words, it's 100% assured that the zeroed data
|
/// turns it into a Box. In other words, it's 100% assured that the zeroed data
|
||||||
/// won't be put temporarily on the stack. You can make a box of any size
|
/// won't be put temporarily on the stack. You can make a box of any size
|
||||||
/// without fear of a stack overflow.
|
/// without fear of a stack overflow.
|
||||||
///
|
///
|
||||||
/// ## Failure
|
/// ## Failure
|
||||||
///
|
///
|
||||||
/// This fails if the allocation fails.
|
/// This fails if the allocation fails.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn try_zeroed_box<T: Zeroable>() -> Result<Box<T>, ()> {
|
pub fn try_zeroed_box<T: Zeroable>() -> Result<Box<T>, ()> {
|
||||||
|
@ -43,6 +43,7 @@ fn test_try_cast_slice_mut() {
|
|||||||
let u32_slice: &mut [u32] = &mut [4, 5, 6];
|
let u32_slice: &mut [u32] = &mut [4, 5, 6];
|
||||||
let u32_len = u32_slice.len();
|
let u32_len = u32_slice.len();
|
||||||
let u32_ptr = u32_slice.as_ptr();
|
let u32_ptr = u32_slice.as_ptr();
|
||||||
|
|
||||||
// the same data as align1
|
// the same data as align1
|
||||||
let the_bytes: &mut [u8] = try_cast_slice_mut(u32_slice).unwrap();
|
let the_bytes: &mut [u8] = try_cast_slice_mut(u32_slice).unwrap();
|
||||||
let the_bytes_len = the_bytes.len();
|
let the_bytes_len = the_bytes.len();
|
||||||
|
Loading…
Reference in New Issue
Block a user