Skip to content

Instantly share code, notes, and snippets.

@SiegeLord
Created March 7, 2014 23:45
Show Gist options
  • Select an option

  • Save SiegeLord/9422642 to your computer and use it in GitHub Desktop.

Select an option

Save SiegeLord/9422642 to your computer and use it in GitHub Desktop.
get/set
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