Improved docs (allman syntax)
This commit is contained in:
@@ -7,11 +7,13 @@ icon: Puzzle
|
||||
### Traits
|
||||
|
||||
```mist
|
||||
pub trait Drawable {
|
||||
pub trait Drawable
|
||||
{
|
||||
void draw(&self);
|
||||
}
|
||||
|
||||
pub trait Comparable<T> : Eq {
|
||||
pub trait Comparable<T> : Eq
|
||||
{
|
||||
i32 cmp(&self, T other);
|
||||
}
|
||||
```
|
||||
@@ -19,7 +21,8 @@ pub trait Comparable<T> : Eq {
|
||||
Trait requirements are specified after `:`:
|
||||
|
||||
```mist
|
||||
trait MyTrait : SuperTrait + OtherTrait {
|
||||
trait MyTrait : SuperTrait + OtherTrait
|
||||
{
|
||||
void required_method(&self);
|
||||
void another(&self);
|
||||
}
|
||||
@@ -28,15 +31,18 @@ trait MyTrait : SuperTrait + OtherTrait {
|
||||
### Impl Blocks
|
||||
|
||||
```mist
|
||||
impl MyType {
|
||||
impl MyType
|
||||
{
|
||||
void method(&self) { }
|
||||
}
|
||||
|
||||
impl Trait for MyType {
|
||||
impl Trait for MyType
|
||||
{
|
||||
void method(&self) { }
|
||||
}
|
||||
|
||||
impl<T> GenericTrait<T> for MyType {
|
||||
impl<T> GenericTrait<T> for MyType
|
||||
{
|
||||
void method(&self, T value) { }
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user