Created
March 7, 2014 23:45
-
-
Save SiegeLord/9422642 to your computer and use it in GitHub Desktop.
get/set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct S; | |
| trait Get | |
| { | |
| fn get(self); | |
| } | |
| trait Set | |
| { | |
| fn set(self); | |
| } | |
| impl<'l> Get for &'l S | |
| { | |
| fn get(self) | |
| { | |
| } | |
| } | |
| impl<'l> Set for &'l mut S | |
| { | |
| fn set(self) | |
| { | |
| } | |
| } | |
| fn main() | |
| { | |
| let s = S; | |
| let mut ms = S; | |
| s.get(); | |
| //~ s.set(); | |
| ms.get(); | |
| ms.set(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment