Lines Matching +full:1 +full:v25

62 //! - [`Unaligned`] indicates that a type's alignment requirement is 1
153 //! compile-time penalties of configuring `codegen-units=1`.
547 // --> examples/deprecated.rs:1:15
549 // 1 | use zerocopy::FromZeroes;
676 /// What about if `z` has length 1?
683 /// In this instance, `z` has length 1, and thus takes up 2 bytes. That means
717 /// in its trailing slice field. However, there is not necessarily a 1-to-1
719 /// the previous section with the type `Foo`, instances with both 0 and 1
858 /// assert_eq!(u8::size_for_metadata(()), Some(1));
1035 // because `CoreMaybeUninit<T>` has the same size and alignment as `T` [1].
1046 // [1] Per https://doc.rust-lang.org/1.81.0/std/mem/union.MaybeUninit.html#layout-1:
1080 // - `()` has alignment 1, so `slc` is trivially aligned. in pointer_to_metadata()
1088 // of slice elements. [1] in pointer_to_metadata()
1090 …// [1] Per https://doc.rust-lang.org/reference/expressions/operator-expr.html#pointer-to-pointer-c… in pointer_to_metadata()
1131 // SAFETY: `str` has the same representation as `[u8]`. `ManuallyDrop<T>` [1],
1134 // [1] Per https://doc.rust-lang.org/1.85.0/std/mem/struct.ManuallyDrop.html:
1179 pub const STRUCT_VARIANT_ID: i128 = -1;
1434 /// 1. its padding is soundly `FromZeros`, and
1629 /// /// Version 1 of the data store.
1649 /// `1`.
1840 /// let bytes = &[0xC0, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5][..];
1846 /// assert_eq!(packet.marshmallows, [[0, 1], [2, 3], [4, 5]]);
1849 /// let bytes = &[0x10, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5][..];
1860 @index 1
1962 /// let bytes = &[0xC0, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5, 6][..];
1968 /// assert_eq!(packet.marshmallows, [[0, 1], [2, 3], [4, 5]]);
1972 /// let bytes = &[0x10, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5, 6][..];
1983 @index 1
2082 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 77, 240, 0xC0, 0x10][..];
2093 @index 1
2182 /// let bytes = &mut [0xC0, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5][..];
2188 /// assert_eq!(packet.marshmallows, [[0, 1], [2, 3], [4, 5]]);
2192 /// assert_eq!(bytes, [0xC0, 0xC0, 240, 111, 0, 1, 2, 3, 4, 5]);
2195 /// let bytes = &mut [0x10, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5, 6][..];
2289 /// let bytes = &mut [0xC0, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5, 6][..];
2295 /// assert_eq!(packet.marshmallows, [[0, 1], [2, 3], [4, 5]]);
2301 /// assert_eq!(bytes, [0xC0, 0xC0, 240, 111, 0, 1, 2, 3, 4, 5, 222]);
2304 /// let bytes = &mut [0x10, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5, 6][..];
2404 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 77, 240, 0xC0, 0x10][..];
2472 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 77, 240, 0xC0, 0xC0][..];
2506 @index 1
2593 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 77, 240, 0xC0, 0xC0][..];
2627 @index 1
2701 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 77, 240, 0xC0, 0xC0][..];
2735 @index 1
2810 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 77, 240, 0xC0, 0xC0][..];
2921 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 77, 240, 0xC0, 0xC0][..];
3021 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 77, 240, 0xC0, 0xC0][..];
3126 // FIXME(#2981): If `align_of::<Self>() == 1`, validate `source` in-place. in try_read_from_bytes()
3171 /// let bytes = &[0xC0, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5, 6][..];
3177 /// assert_eq!(suffix, &[0u8, 1, 2, 3, 4, 5, 6][..]);
3180 /// let bytes = &[0x10, 0xC0, 240, 77, 0, 1, 2, 3, 4, 5, 6][..];
3204 // FIXME(#2981): If `align_of::<Self>() == 1`, validate `source` in-place. in try_read_from_prefix()
3250 /// let bytes = &[0, 1, 2, 3, 4, 5, 0xC0, 0xC0, 240, 77][..];
3256 /// assert_eq!(prefix, &[0u8, 1, 2, 3, 4, 5][..]);
3259 /// let bytes = &[0, 1, 2, 3, 4, 5, 0x10, 0xC0, 240, 77][..];
3283 // FIXME(#2981): If `align_of::<Self>() == 1`, validate `source` in-place. in try_read_from_suffix()
3519 @index 1
3541 // - `u8`'s alignment is 1, and thus `self` is guaranteed to be aligned in zero()
3629 // SAFETY: Per [1], when `T` is a ZST, `Box<T>`'s only validity in new_box_zeroed()
3635 // [1] Per https://doc.rust-lang.org/1.81.0/std/boxed/index.html#memory-layout: in new_box_zeroed()
3685 @index 1
3853 /// # V1E, V1F, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V2A, V2B, V2C,
3922 /// 1. its padding is soundly `FromBytes`, and
3991 /// # V1E, V1F, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V2A, V2B, V2C,
4073 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4119 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][..];
4123 /// assert_eq!(packet.header.src_port, [0, 1]);
4137 @index 1
4181 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4230 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][..];
4234 /// assert_eq!(packet.header.src_port, [0, 1]);
4249 @index 1
4289 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4328 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
4332 /// assert_eq!(prefix, &[0, 1, 2, 3, 4, 5][..]);
4343 @index 1
4381 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4424 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7][..];
4428 /// assert_eq!(header.src_port, [0, 1]);
4435 /// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 0, 0]);
4471 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4514 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
4518 /// assert_eq!(header.src_port, [0, 1]);
4525 /// body.fill(1);
4527 /// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 0, 0, 1, 1]);
4561 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4598 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
4602 /// assert_eq!(prefix, &[0u8, 1, 2, 3, 4, 5][..]);
4606 /// trailer.frame_check_sequence.fill(1);
4608 /// assert_eq!(bytes, [0, 0, 0, 0, 0, 0, 1, 1, 1, 1]);
4638 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4656 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7][..];
4661 /// Pixel { r: 0, g: 1, b: 2, a: 3 },
4696 @index 1
4735 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4754 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
4759 /// Pixel { r: 0, g: 1, b: 2, a: 3 },
4795 @index 1
4829 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4848 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
4852 /// assert_eq!(prefix, &[0, 1]);
4889 @index 1
4923 /// [size-error-from]: error/struct.SizeError.html#method.from-1
4941 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7][..];
4946 /// Pixel { r: 0, g: 1, b: 2, a: 3 },
4950 /// pixels[1] = Pixel { r: 0, g: 0, b: 0, a: 0 };
4952 /// assert_eq!(bytes, [0, 1, 2, 3, 0, 0, 0, 0]);
5009 /// [size-error-from]: error/struct.SizeError.html#method.from-1
5028 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
5033 /// Pixel { r: 0, g: 1, b: 2, a: 3 },
5039 /// pixels[1] = Pixel { r: 0, g: 0, b: 0, a: 0 };
5040 /// suffix.fill(1);
5042 /// assert_eq!(bytes, [0, 1, 2, 3, 0, 0, 0, 0, 1, 1]);
5094 /// [size-error-from]: error/struct.SizeError.html#method.from-1
5113 /// let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
5117 /// assert_eq!(prefix, &[0, 1]);
5125 /// pixels[1] = Pixel { r: 0, g: 0, b: 0, a: 0 };
5188 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7][..];
5192 /// assert_eq!(header.src_port, [0, 1]);
5245 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
5249 /// assert_eq!(header.src_port, [0, 1]);
5300 /// let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];
5304 /// assert_eq!(prefix, [0, 1, 2, 3, 4, 5]);
5544 /// 1 | #[derive(IntoBytes)]
5716 /// src_port: [0, 1],
5724 /// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 6, 7]);
5734 @index 1
5763 // - `slf` is trivially aligned to `align_of::<u8>() == 1`. in as_bytes()
5797 /// src_port: [0, 1],
5805 /// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 6, 7]);
5813 /// checksum: [1, 0],
5839 // - `slf` is trivially aligned to `align_of::<u8>() == 1`. in as_mut_bytes()
5874 /// src_port: [0, 1],
5884 /// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 6, 7]);
5908 @index 1
5960 /// src_port: [0, 1],
5970 /// assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 6, 7, 0, 0]);
5994 @index 1
6048 /// src_port: [0, 1],
6058 /// assert_eq!(bytes, [0, 0, 0, 1, 2, 3, 4, 5, 6, 7]);
6089 @index 1
6241 /// - If `repr(align(N))` is provided, `N` must equal 1.
6245 /// `repr(packed)` or `repr(packed(1))`.
6247 /// - If `repr(align(N))` is provided, `N` must equal 1.
6258 /// If `T: Unaligned`, then `align_of::<T>() == 1`.
6487 // `&mut Unsized`. [1] Even if it turns out that this isn't actually in from_mut_slice()
6491 // [1] https://github.com/rust-lang/unsafe-code-guidelines/issues/375 in from_mut_slice()
6522 test!((), layout(0, 1, None, false)); in test_known_layout()
6523 test!(u8, layout(1, 1, None, false)); in test_known_layout()
6531 test!([()], layout(0, 1, Some(0), true)); in test_known_layout()
6532 test!([u8], layout(0, 1, Some(1), true)); in test_known_layout()
6533 test!(str, layout(0, 1, Some(1), true)); in test_known_layout()
6628 assert_eq!(<KL01Packed as KnownLayout>::LAYOUT, sized_layout(1, 6)); in test_known_layout_derive()
6652 assert_eq!(<KL03 as KnownLayout>::LAYOUT, sized_layout(1, 1)); in test_known_layout_derive()
6674 assert_eq!(<KL03Packed as KnownLayout>::LAYOUT, sized_layout(1, 5)); in test_known_layout_derive()
6722 assert_eq!(<KL10 as KnownLayout>::LAYOUT, unsized_layout(4, 1, 4, false)); in test_known_layout_derive()
6738 assert_eq!(<KL10Align as KnownLayout>::LAYOUT, unsized_layout(64, 1, 4, false)); in test_known_layout_derive()
6746 let repr_packed = NonZeroUsize::new(1); in test_known_layout_derive()
6754 assert_eq!(<KL10Packed as KnownLayout>::LAYOUT, unsized_layout(1, 1, 4, false)); in test_known_layout_derive()
6770 assert_eq!(<KL10PackedN as KnownLayout>::LAYOUT, unsized_layout(2, 1, 4, false)); in test_known_layout_derive()
6809 let repr_packed = NonZeroUsize::new(1); in test_known_layout_derive()
6817 assert_eq!(<KL11Packed as KnownLayout>::LAYOUT, sized_layout(1, 9)); in test_known_layout_derive()
6870 assert_eq!(<KLTU<(), ()> as KnownLayout>::LAYOUT, sized_layout(1, 0)); in test_known_layout_derive()
6872 assert_eq!(<KLTU<(), u8> as KnownLayout>::LAYOUT, sized_layout(1, 1)); in test_known_layout_derive()
6876 assert_eq!(<KLTU<(), [()]> as KnownLayout>::LAYOUT, unsized_layout(1, 0, 0, false)); in test_known_layout_derive()
6878 assert_eq!(<KLTU<(), [u8]> as KnownLayout>::LAYOUT, unsized_layout(1, 1, 0, false)); in test_known_layout_derive()
6882 assert_eq!(<KLTU<u8, ()> as KnownLayout>::LAYOUT, sized_layout(1, 1)); in test_known_layout_derive()
6884 assert_eq!(<KLTU<u8, u8> as KnownLayout>::LAYOUT, sized_layout(1, 2)); in test_known_layout_derive()
6888 assert_eq!(<KLTU<u8, [()]> as KnownLayout>::LAYOUT, unsized_layout(1, 0, 1, false)); in test_known_layout_derive()
6890 assert_eq!(<KLTU<u8, [u8]> as KnownLayout>::LAYOUT, unsized_layout(1, 1, 1, false)); in test_known_layout_derive()
6902 assert_eq!(<KLTU<AU16, [u8]> as KnownLayout>::LAYOUT, unsized_layout(2, 1, 2, false)); in test_known_layout_derive()
6912 assert_eq!(<KLF0 as KnownLayout>::LAYOUT, sized_layout(1, 0)); in test_known_layout_derive()
6918 assert_eq!(<KLF1 as KnownLayout>::LAYOUT, unsized_layout(1, 1, 0, true)); in test_known_layout_derive()
6924 assert_eq!(<KLF2 as KnownLayout>::LAYOUT, unsized_layout(1, 1, 1, false)); in test_known_layout_derive()
6930 assert_eq!(<KLF3 as KnownLayout>::LAYOUT, unsized_layout(2, 1, 4, false)); in test_known_layout_derive()
6936 assert_eq!(<KLF4 as KnownLayout>::LAYOUT, unsized_layout(4, 1, 8, false)); in test_known_layout_derive()
6995 assert_eq!(<[()]>::ref_from_suffix_with_elems(&[][..], 3).unwrap().1.len(), 3); in test_zst_count_preserved()
6998 assert_eq!(<[()]>::mut_from_suffix_with_elems(&mut [][..], 3).unwrap().1.len(), 3); in test_zst_count_preserved()
7086 assert_eq!(<bool as TryFromBytes>::try_read_from_bytes(&[1]), Ok(true)); in test_try_from_bytes_try_read_from()
7089 assert_eq!(<bool as TryFromBytes>::try_read_from_prefix(&[1, 2]), Ok((true, &[2][..]))); in test_try_from_bytes_try_read_from()
7092 assert_eq!(<bool as TryFromBytes>::try_read_from_suffix(&[2, 1]), Ok((&[2][..], true))); in test_try_from_bytes_try_read_from()
7134 assert_eq!(<AU64 as TryFromBytes>::try_read_from_bytes(&bytes[1..9]), Ok(AU64(0))); in test_try_from_bytes_try_read_from()
7141 <AU64 as TryFromBytes>::try_read_from_prefix(&bytes[1..9]), in test_try_from_bytes_try_read_from()
7150 <AU64 as TryFromBytes>::try_read_from_suffix(&bytes[1..9]), in test_try_from_bytes_try_read_from()
7162 Align::<[u8; 16], AU64>::new([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); in test_ref_from_mut_from_bytes()
7174 (&[0, 1, 2, 3, 4, 5, 6][..], &[7u8, 1, 1, 1, 1, 1, 1, 1, 1]) in test_ref_from_mut_from_bytes()
7176 let (prefix, suffix) = AU64::mut_from_suffix(&mut buf.t[1..]).unwrap(); in test_ref_from_mut_from_bytes()
7177 assert_eq!(prefix, &mut [1u8, 2, 3, 4, 5, 6, 7][..]); in test_ref_from_mut_from_bytes()
7180 assert_eq!(prefix, &mut [0u8, 1, 2, 3, 4, 5][..]); in test_ref_from_mut_from_bytes()
7184 (&[0u8, 1, 2, 3, 4, 5, 42, 7, 2], &[2u8, 2, 2, 2, 2, 2, 2][..]) in test_ref_from_mut_from_bytes()
7186 <[u8; 2]>::mut_from_prefix(&mut buf.t[..]).unwrap().0[1] = 30; in test_ref_from_mut_from_bytes()
7220 assert!(AU64::ref_from_bytes(&buf.t[1..]).is_err()); in test_ref_from_mut_from_bytes_error()
7221 assert!(AU64::mut_from_bytes(&mut buf.t[1..]).is_err()); in test_ref_from_mut_from_bytes_error()
7222 assert!(AU64::ref_from_bytes(&buf.t[1..]).is_err()); in test_ref_from_mut_from_bytes_error()
7223 assert!(AU64::mut_from_bytes(&mut buf.t[1..]).is_err()); in test_ref_from_mut_from_bytes_error()
7224 assert!(AU64::ref_from_prefix(&buf.t[1..]).is_err()); in test_ref_from_mut_from_bytes_error()
7225 assert!(AU64::mut_from_prefix(&mut buf.t[1..]).is_err()); in test_ref_from_mut_from_bytes_error()
7256 assert!(t.write_to(&mut vec![0; N - 1][..]).is_err()); in test_to_methods()
7257 assert!(t.write_to(&mut vec![0; N + 1][..]).is_err()); in test_to_methods()
7265 assert!(t.write_to_prefix(&mut vec![0; N - 1][..]).is_err()); in test_to_methods()
7274 let mut too_many_bytes = vec![0; N + 1]; in test_to_methods()
7281 assert!(t.write_to_suffix(&mut vec![0; N - 1][..]).is_err()); in test_to_methods()
7290 let mut too_many_bytes = vec![0; N + 1]; in test_to_methods()
7293 assert_eq!(&too_many_bytes[1..], t.as_bytes()); in test_to_methods()
7306 vec![1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0] in test_to_methods()
7308 vec![0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0] in test_to_methods()
7313 &mut Foo { a: 1, b: Wrapping(2), c: None }, in test_to_methods()
7318 Unsized::from_mut_slice(&mut [1, 2, 3]), in test_to_methods()
7319 &[1, 2, 3], in test_to_methods()
7431 u64::insert_vec_zeroed(&mut v, 1, 1).unwrap(); in test_insert_vec_zeroed()
7438 u64::insert_vec_zeroed(&mut v, 3, 1).unwrap(); in test_insert_vec_zeroed()
7463 <()>::insert_vec_zeroed(&mut v, 1, 1).unwrap(); in test_insert_vec_zeroed_zst()
7470 <()>::insert_vec_zeroed(&mut v, 3, 1).unwrap(); in test_insert_vec_zeroed_zst()
7501 s[1] = 3; in test_new_box_zeroed_with_elems()
7520 assert_eq!(s[1], ()); in test_new_box_zeroed_with_elems_zst()
7537 <[u16]>::new_box_zeroed_with_elems((max / mem::size_of::<u16>()) + 1), in new_box_zeroed_with_elems_errors()
7591 assert_eq!(AsAddress::addr(ptr), 1); in test_raw_dangling()
7594 assert_eq!(AsAddress::addr(ptr), 1); in test_raw_dangling()