Skip to content

Instantly share code, notes, and snippets.

@Nemikolh
Forked from rust-play/playground.rs
Created May 11, 2018 12:59
Show Gist options
  • Save Nemikolh/8e5c1725c7111acb7f2390156d831eff to your computer and use it in GitHub Desktop.
Save Nemikolh/8e5c1725c7111acb7f2390156d831eff to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
#![feature(generators, generator_trait)]
use std::ops::Generator;
use std::mem::size_of;
fn test() -> impl Generator<Yield=(), Return=()> {
return || {
yield ();
}
}
fn consume<F, O>(f: F)
where F: Fn() -> O
{
println!("{}", size_of::<O>());
}
fn main() {
consume(test);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment