diff --git a/examples/associated_functions.reid b/examples/associated_functions.reid index 9421ad8..d67b852 100644 --- a/examples/associated_functions.reid +++ b/examples/associated_functions.reid @@ -1,3 +1,7 @@ +import std::print; +import std::from_str; +import std::String; + struct Otus { field: u32, } @@ -8,7 +12,17 @@ impl Otus { } } +impl i32 { + fn test(&self) -> u32 { + 43 + } +} + fn main() -> u32 { let otus = Otus { field: 17 }; + let num = 54; + print(from_str("otus: ") + Otus::test(&otus) as u64); + print(from_str("i32: ") + i32::test(&num) as u64); + return Otus::test(&otus); }