mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 04:57:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			259 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			259 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| trait Animal {
 | |
|   fn eat(&self);
 | |
| }
 | |
| 
 | |
| struct Cat {
 | |
|   meows: usize,
 | |
| }
 | |
| 
 | |
| impl Animal for Cat {
 | |
|     //~^ ERROR not all trait items implemented, missing: `eat`
 | |
| }
 | |
| 
 | |
| fn cat(in_x : usize) -> Cat {
 | |
|     Cat {
 | |
|         meows: in_x
 | |
|     }
 | |
| }
 | |
| 
 | |
| fn main() {
 | |
|   let nyan = cat(0);
 | |
| }
 | 
