Hand two slices of one struct to two functions
Each function takes a projection type — Doc.{ title }, Doc.{ body } — so passing a slice moves just that field. The two calls do not overlap, so both are allowed, and sig is still there afterward. Rust does disjoint borrows; moving first-class field projections is a Metel thing.
struct Doc { title: String, body: String, sig: String }
fun headline(part: Doc.{ title }) -> i64 { part.title.len() }
fun render(part: Doc.{ body }) -> i64 { part.body.len() }
fun main() {
let d := Doc { title = "Metel", body = "the spec", sig = "v0.13" };
let a := headline(d.{ title }); // moves title out
let b := render(d.{ body }); // disjoint — moves body out
println("${a} ${b} ${d.sig}"); // sig untouched
}
In the tutorial