mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			443 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			443 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ edition:2018
 | |
| //@ check-pass
 | |
| 
 | |
| use std::any::Any;
 | |
| use std::future::Future;
 | |
| 
 | |
| struct Client(Box<dyn Any + Send>);
 | |
| 
 | |
| impl Client {
 | |
|     fn status(&self) -> u16 {
 | |
|         200
 | |
|     }
 | |
| }
 | |
| 
 | |
| async fn get() {}
 | |
| 
 | |
| pub fn foo() -> impl Future + Send {
 | |
|     let client = Client(Box::new(true));
 | |
|     async move {
 | |
|         match client.status() {
 | |
|             200 => {
 | |
|                 get().await;
 | |
|             }
 | |
|             _ => (),
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| fn main() {}
 | 
