1
Fork 0

add is_sized method on Abi and Layout, and use it

This commit is contained in:
Ralf Jung 2022-11-13 12:14:59 +01:00
parent 742d3f02c2
commit c78021709a
21 changed files with 39 additions and 29 deletions

View file

@ -1083,6 +1083,11 @@ impl Abi {
}
}
#[inline]
pub fn is_sized(&self) -> bool {
!self.is_unsized()
}
/// Returns `true` if this is a single signed integer scalar
#[inline]
pub fn is_signed(&self) -> bool {
@ -1490,6 +1495,11 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
self.abi.is_unsized()
}
#[inline]
pub fn is_sized(&self) -> bool {
self.abi.is_sized()
}
/// Returns `true` if the type is a ZST and not unsized.
pub fn is_zst(&self) -> bool {
match self.abi {