core::reflect::field
API 參考只有英文版,由標準函式庫原始碼中的英文文件註解產生。
Field, one field of a struct or variant.
Structs
FieldSource
pub struct FieldOne field of an Inspect struct, or of one variant of an enum.
The name;
"0","1", .. in a tuple struct or variant.The name it had before a
#[renamed_from("..")], else empty.Its type.
Its offset in bytes from the start of the value;
usize::MAXwhen it has no fixed place.Its position in declaration order.
A plain
pubfield.It has a
= exprdefault.The runtime attribute
Aon the field, if it has one:f.attr::<Range>().The runtime attributes on the field.
The field's value in
owner;nonewhenowneris not of the field's type (or holds another variant).The field's value as a
T, ascast::<T>(field.get(owner)).Sets the field in
ownertovalue;falsewhenowneris not of the field's type orvaluedoes not fit it (an integer fits when its value does).ownergets a changed copy: a struct is a value. A variant's payload is read-only.