Skip to main content

align

Function align 

Source
pub fn align(
    types: &Types,
    id: TypeId,
    target: &TargetInfo,
) -> Result<u64, LayoutError>
Expand description

What an object of id has to be aligned to, whether or not it has a size here.

The number layout answers with wherever there is one. Where there is not, which is a variable length array or a record with one among its members, there is still an alignment, because an alignment never depends on a length: an array is as aligned as its element however long it turns out to be, and a record’s alignment is decided by its members rather than by where they land.

§Errors

LayoutError when the type has no alignment either, which is every reason layout has for having no size but the one this is here for.