【问题标题】:Find the item in an array with the largest property查找具有最大属性的数组中的项目
【发布时间】:2016-06-30 02:38:50
【问题描述】:

我有一个这样的结构

struct Point {
    pub x: i32,
    pub y: i32,
}

impl Point {
    fn new(x: i32, y: i32) -> Self {
        Point { x, y }
    }
}

还有这样的数组

[Point::new(1, 1), Point::new(4, 2), Point::new(2, 9)];

如何从这个数组中拉出point.x 最大的项目?

【问题讨论】:

    标签: rust


    【解决方案1】:
    猜你喜欢
    • 2014-05-10
    • 1970-01-01
    • 2020-10-12
    • 1970-01-01
    • 2014-05-07
    • 2019-04-14
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    相关资源
    最近更新 更多