We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a half-baked idea, and it requires the unstable associated_const_equality feature. Also, the AlignedTo impls don't currently work thanks to rust-lang/rust#103292.
AlignedTo
trait Size { const SIZE: usize; } impl<T> Size for T { const SIZE: usize = core::mem::size_of::<T>(); } trait Align { const ALIGN: usize; } impl<T> Align for T { const ALIGN: usize = core::mem::align_of::<T>(); } trait Zst {} impl<T: Size<SIZE = 0>> Zst for T {} trait SameSizeAs<T> {} impl<const SIZE: usize, T: Size<SIZE = { SIZE }>, U: Size<SIZE = { SIZE }>> SameSizeAs<U> for T {} trait AlignedTo<T> {} impl<T: Align<ALIGN = 1>, U: Align<ALIGN = 1>> AlignedTo<U> for T {} impl<T: Align<ALIGN = 2>, U: Align<ALIGN = 2>> AlignedTo<U> for T {} impl<T: Align<ALIGN = 2>, U: Align<ALIGN = 1>> AlignedTo<U> for T {} impl<T: Align<ALIGN = 4>, U: Align<ALIGN = 4>> AlignedTo<U> for T {} impl<T: Align<ALIGN = 4>, U: Align<ALIGN = 2>> AlignedTo<U> for T {} impl<T: Align<ALIGN = 4>, U: Align<ALIGN = 1>> AlignedTo<U> for T {}
The text was updated successfully, but these errors were encountered:
Merging into #1316.
Sorry, something went wrong.
No branches or pull requests
This is a half-baked idea, and it requires the unstable associated_const_equality feature. Also, the
AlignedTo
impls don't currently work thanks to rust-lang/rust#103292.The text was updated successfully, but these errors were encountered: