rust trait
pub trait Summary {
fn summarize(&self) -> String;
}
trait in rust
struct Point(isize, isize);
trait IPoint {
fn new(x: isize, y: isize) -> Point {
Point(x, y)
}
fn coord(&self) -> (isize, isize);
}
impl IPoint for Point {
fn coord(&self) -> (isize, isize) {
(self.0, self.1)
}
}