Skip to content

Instantly share code, notes, and snippets.

@0X1A
Created April 19, 2019 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0X1A/70b3d2209336bd4606768c2e5c9e9635 to your computer and use it in GitHub Desktop.
Save 0X1A/70b3d2209336bd4606768c2e5c9e9635 to your computer and use it in GitHub Desktop.
struct MyStruct {}
trait SayHi {
fn hi(name: String) -> bool;
}
impl SayHi for MyStruct {
fn hi(name: String) -> bool {
print "Hi from " + name + "!";
return true;
}
}
let struct_instance: MyStruct = MyStruct();
let return_value: bool = struct_instance.hi("Lang");
print return_value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment