Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo {
- b: Bar,
- z: Baz,
- }
- struct Bar {
- n: u32,
- }
- impl Bar {
- fn eat(self) -> u32 {
- self.n
- }
- }
- struct Baz {
- c: char,
- }
- impl Baz {
- fn get(&self) -> char {
- self.c
- }
- }
- fn close<F>(f: F) -> char
- where F: Fn() -> char {
- f()
- }
- fn main() {
- let f = Foo{
- b: Bar{ n: 12u32 },
- z: Baz{ c: 'a' },
- };
- let _n = f.b.eat();
- let z = f.z;
- close(|| z.get() );
- }
Add Comment
Please, Sign In to add comment