Struct literals

https://doc.rust-lang.org/reference/items/structs.html

Structs are created with the struct keyword:

#![allow(unused)]
fn main() {
struct Point {
    x: f64, // 64-bit floating point, aka "double precision"
    y: f64,
}
}

You can create an instance of your struct with a struct literal

#![allow(unused)]
fn main() {
let positive_point = Point { x: 0.0, y: 13.0 };
let negative_point = Point { y: 0.0, x: -13.0 };
}

Destructuring works for structs too:

#![allow(unused)]
fn main() {
let Point { x, .. } = Point { x: 1.0, y: 2.0 }; // only keep x from this point
println!("{}", x);
}

Structs can be generic too:

#![allow(unused)]
fn main() {
struct Pair<T> {
    a: T,
    b: T,
}
}

Same rules apply for constraints as with functions.