2017-02-19から1日間の記事一覧

Operators and Overloading

https://doc.rust-lang.org/book/operators-and-overloading.html 新たに定義した型に対して+を定義できる。 use std::ops::Add; #[derive(Debug)] struct Point { x: i32, y: i32, } impl Add for Point { type Output = Point; fn add(self, other: Point)…