error unknown-field
У типа нет такого поля.
What it means#
The field name does not exist in the data type, in its embedded types (§4.7), or among the variant fields of the enum (§4.2, §4.4). It is reported for field access, for struct literals and for patterns.
Example#
data User {
id: u64
name: str
}
fn main() {
let u = User{ id: 1, name: "Ann" }
print(u.nmae) // <- unknown-field
}error
unknown-field
How to fix#
data User {
id: u64
name: str
}
fn main() {
let u = User{ id: 1, name: "Ann" }
print(u.name)
}Correct the name, or add the field to the type.