dungeon_cell/marker_traits/layout.rs
1use core::panic::{RefUnwindSafe, UnwindSafe};
2
3use crate::layout::Layout;
4
5use super::sealed::Sealed;
6
7use super::{IsAlignment, IsSize};
8
9/// Marker only implemented for [`Layout`][crate::layout::Layout].
10///
11/// This trait is [sealed](https://rust-lang.github.io/api-guidelines/future-proofing.html#sealed-traits-protect-against-downstream-implementations-c-sealed)
12/// and cannot be implemented by external types.
13pub trait IsLayout:
14 Sealed
15 + Sized
16 + Sync
17 + Send
18 + Copy
19 + Clone
20 + Unpin
21 + RefUnwindSafe
22 + UnwindSafe
23 + 'static
24{
25 /// Size of the layout.
26 type Size: IsSize;
27
28 /// Alignment requirement of the layout;
29 type Alignment: IsAlignment;
30}
31
32impl<Size: IsSize, Alignment: IsAlignment> Sealed for Layout<Size, Alignment> {}