mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-09 17:48:24 +00:00
22 lines
226 B
Rust
22 lines
226 B
Rust
|
extern fn printf(a: &str);
|
||
|
|
||
|
fn main() -> u32 {
|
||
|
let x: A = A {
|
||
|
a: 2
|
||
|
};
|
||
|
|
||
|
let y: u32 = x.hello(4);
|
||
|
|
||
|
return y;
|
||
|
}
|
||
|
|
||
|
struct A {
|
||
|
a: u32,
|
||
|
}
|
||
|
|
||
|
impl A {
|
||
|
pub fn hello(self: &A, x: u32) -> u32 {
|
||
|
return self.a + x;
|
||
|
}
|
||
|
}
|