True and FalSe
xxxxxxxxxx
let b: bool = true;
More at the doc, link attached
It is similar to Interface of TypeScript
xxxxxxxxxx
trait Seq<T> {
fn len(&self) -> u32;
fn elt_at(&self, n: u32) -> T;
fn iter<F>(&self, f: F) where F: Fn(T);
}
xxxxxxxxxx
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)
}
}