2017-01-29から1日間の記事一覧

Method Syntax

https://doc.rust-lang.org/book/method-syntax.html Go言語のように、( struct )型に対してメソッドを定義する方式のようだ。 struct Circle { x: f64, y: f64, radius: f64, } impl Circle { fn area(&self) -> f64 { std::f64::consts::PI * (self.radius…