Improved docs (allman syntax)

This commit is contained in:
2026-07-03 22:21:33 +02:00
parent ddf3efdf6e
commit 581390933d
8 changed files with 57 additions and 38 deletions
+12 -6
View File
@@ -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) { }
}
```