--- title: Traits & Impls description: Defining traits, trait bounds, and implementation blocks. icon: Puzzle --- ### Traits ```mist pub trait Drawable { void draw(&self); } pub trait Comparable : Eq { i32 cmp(&self, T other); } ``` Trait requirements are specified after `:`: ```mist trait MyTrait : SuperTrait + OtherTrait { void required_method(&self); void another(&self); } ``` ### Impl Blocks ```mist impl MyType { void method(&self) { } } impl Trait for MyType { void method(&self) { } } impl GenericTrait for MyType { void method(&self, T value) { } } ```