There was an error while loading. Please reload this page.
1 parent d5a75f3 commit e40f470Copy full SHA for e40f470
src/types.rs
@@ -22,6 +22,18 @@ impl<T: Copy> Default for Padding<T> {
22
}
23
24
25
+impl<T: Copy> Padding<T> {
26
+ /// Const constructor for uninitialized padding in const contexts.
27
+ // FIXME: Change this into zeroed() and use MaybeUninit::zeroed()
28
+ // when we depend on rustc 1.75.0.
29
+ #[allow(unused)]
30
+ pub(crate) const fn uninit() -> Self {
31
+ // We can still safely use uninit here, since padding are is something
32
+ // that can are not meant to be read or written anyways.
33
+ Self(MaybeUninit::uninit())
34
+ }
35
+}
36
+
37
impl<T: Copy> fmt::Debug for Padding<T> {
38
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39
// Taken frmo `MaybeUninit`'s debug implementation
0 commit comments