Currently, mir-json outputs layout information size, align, and field offsets only for sized types. Unsized types don't have a size, but they may have a statically-known alignment and/or field offsets. Specifically:
[T] has a statically known alignment, but an unknown number of fields
dyn Trait does not have statically known alignment or fields
MyStruct<[T]> (a custom DST with [T] tail) has a statically known alignment and statically known field offsets (the last field of the struct being [T], which has unknown size and field count)
MyStruct<dyn Trait> has unknown alignment, though it must be at least as high as the maximum alignment among the non-last fields of MyStruct (but it could be higher depending on the alignment of the erased type). It has statically-known offsets for all of the non-last fields, but the offset of the last field may vary depending on the alignment of the erased type and thus is not statically known.
This playground demonstrates the custom DST cases.
Currently, mir-json outputs layout information size, align, and field offsets only for sized types. Unsized types don't have a size, but they may have a statically-known alignment and/or field offsets. Specifically:
[T]has a statically known alignment, but an unknown number of fieldsdyn Traitdoes not have statically known alignment or fieldsMyStruct<[T]>(a custom DST with[T]tail) has a statically known alignment and statically known field offsets (the last field of the struct being[T], which has unknown size and field count)MyStruct<dyn Trait>has unknown alignment, though it must be at least as high as the maximum alignment among the non-last fields ofMyStruct(but it could be higher depending on the alignment of the erased type). It has statically-known offsets for all of the non-last fields, but the offset of the last field may vary depending on the alignment of the erased type and thus is not statically known.This playground demonstrates the custom DST cases.