mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			264 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			264 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| #![feature(coroutines, coroutine_trait)]
 | |
| 
 | |
| use std::ops::Coroutine;
 | |
| use std::pin::Pin;
 | |
| 
 | |
| fn main() {
 | |
|     run_coroutine::<i32>();
 | |
| }
 | |
| 
 | |
| fn run_coroutine<T>() {
 | |
|     let mut coroutine = || {
 | |
|         yield;
 | |
|         return;
 | |
|     };
 | |
|     Pin::new(&mut coroutine).resume(());
 | |
| }
 | 
