The only data layout guarantees made by this representation are those required for soundness. They are:
The fields are properly aligned.
The fields do not overlap.
The alignment of the type is at least the maximum alignment of its fields.
Formally, the first guarantee means that the offset of any field is divisible by that field's alignment. The second guarantee means that the fields can be ordered such that the offset plus the size of any field is less than or equal to the offset of the next field in the ordering. The ordering does not have to be the same as the order in which the fields are specified in the declaration of the type.
Be aware that the second guarantee does not imply that the fields have distinct addresses: zero-sized types may have the same address as other fields in the same struct.
There are no other guarantees of data layout made by this representation.
clang-reorder-fields
__dict__
use formy::Form;
#[derive(Form)]
struct UserLogin {
#[input(pattern = r"[\w]+")]
#[label = "Username:"]
username: String,
#[input(type = "email", name = "real_email", class="py-4", id = "email")]
email: String,
#[input(type = "password")]
#[label = "Password:"]
password: String,
some_field: String,
}
let form = UserLogin::to_form();
clang-reorder-fields