rust_demos 0.1.0

Aa demo crate
Documentation
fn main(){
	//Stack allocation @copy trait
	/*let a=10;
	let b=a;
	println!("a:{a},b:{b}");*/

	//Heap allocation @move traits
	//using clone
	/*let s1=String::from("Hello");
	let s2=s1.clone();
	println!("s1:{s1},s2:{s2}");*/

	//Borrowing 
	/*let s1=String::from("Hello");
	{
	let s2=&s1;
	println!("s2:{s2}");
	}
	//println!("s1:{s1},s2:{s2}");  // s2 is out of scope here
	println!("s1:{s1}");*/

	let mut s1=String::from("Hello");
	let s2=&mut s1;  
	s2.push_str(" World");
	println!("s2:{s2}");  // mutable reference s2 is out og scope from here
	println!("s1:{s1}");
	let s3=&s1;
	let s4=&s1;
	println!("s1:{s1}");
	println!("s3:{s3},s4:{s4}");

}