Skip to content

Commit fa5c3df

Browse files
authored
Add a zeroed constructor for io_uring::open_at. (#1379)
Now that it's `non_exhaustive`, it's covenient to have a constructor that allows creating fully-defaulted values in `const` contexts.
1 parent d22bc1e commit fa5c3df

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/io_uring/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,6 +1797,17 @@ pub struct open_how {
17971797
pub resolve: ResolveFlags,
17981798
}
17991799

1800+
impl open_how {
1801+
/// Create a zero-initialized `Self`.
1802+
pub const fn zeroed() -> Self {
1803+
Self {
1804+
flags: 0,
1805+
mode: 0,
1806+
resolve: ResolveFlags::empty(),
1807+
}
1808+
}
1809+
}
1810+
18001811
#[allow(missing_docs)]
18011812
#[repr(C)]
18021813
#[derive(Debug, Copy, Clone, Default)]

0 commit comments

Comments
 (0)