> built-in type
record
methods of record values
Records are untyped values with named fields, written @{ x: 1, name: "text" }. They also come from std::any::record (which turns a struct into a record) and from native functions that return Rust types. These are methods on any record value; there is no module to import.
Records don't change: the set_ methods return a new record and leave the original as it was. Fields keep the order they were written in, and a new field goes at the end. A record's methods are fields that hold a function.
> methods
The value of field name, or None if the record has no such field.
The function stored in field name, or None if there is no such field or its value is not a function.
A copy of the record with field name set to value. An existing field is replaced in place; otherwise the field is added at the end.
> examples
use std::io;
fn main() {
let point = @{ x: 1, y: 2 };
io::println("fields: {}", point.fields());
io::println("x = {}", point.get_field("x").unwrap());
let moved = point.set_field("x", 10);
io::println("moved = {}, point = {}", moved, point);
}