added workspaces example
This commit is contained in:
		
							parent
							
								
									eb0612b93b
								
							
						
					
					
						commit
						aec66ef7c8
					
				
					 5 changed files with 42 additions and 0 deletions
				
			
		
							
								
								
									
										9
									
								
								the_book/workspaces/add_one/Cargo.toml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								the_book/workspaces/add_one/Cargo.toml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
[package]
 | 
			
		||||
name = "add_one"
 | 
			
		||||
version = "0.1.0"
 | 
			
		||||
edition = "2021"
 | 
			
		||||
 | 
			
		||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 | 
			
		||||
 | 
			
		||||
[dependencies]
 | 
			
		||||
rand = "0.8.3"
 | 
			
		||||
							
								
								
									
										12
									
								
								the_book/workspaces/add_one/src/lib.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								the_book/workspaces/add_one/src/lib.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
pub fn add_one(x: i32) -> i32 {
 | 
			
		||||
    x + 1
 | 
			
		||||
}
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod tests {
 | 
			
		||||
    use super::*;
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn it_works() {
 | 
			
		||||
        assert_eq!(3, add_one(2))
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue