//Rust 泛型与特性 struct Point { x: T, y: T, }
impl Point { fn x(&self) -> &T { &self.x } }
fn main() { let p = Point { x: 1, y: 2 }; println!("p.x = {}", p.x()); }
1
共 0 条评论, 1 页
//Rust 泛型与特性 struct Point { x: T, y: T, }
impl Point { fn x(&self) -> &T { &self.x } }
fn main() { let p = Point { x: 1, y: 2 }; println!("p.x = {}", p.x()); }
评论区
写评论还没有评论