Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code shared from the Rust Playground
#![feature(nll)]
use std::cell::Cell;
trait Thing: Sized {
fn do_the_thing(&mut self, s: i32) {}
}
impl<T> Thing for Cell<T> {}
fn main() {
use std::ops::AddAssign;
let mut x = Cell::new(1);
let l = &x;
x // (1)
.do_the_thing(
{
x.set(3);
l.set(4);
x.get() // (2)
+
l.get() // (4)
}
) // (3)
;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.