Leon Ding


	// author.rs 2021-09-16 17:12:27	
	fn main() {
		// 创建一个实例
		let engineer = Programmer {
			name: String::from("Leon Ding"), // String类型内容可变
			skill: ["Java","Go","Rust"], // 一个长度为3的字符串面量类型的数组
			sex: Gender::Boy, // 通过枚举限制参数类型
			age: 21,
			address: "Shanghai",
		};

		println!("engineer = {:?}",engineer);
	}
			
	// 枚举限制取值范围
	#[derive(Debug)]
	enum Gender {
		Boy,
		Girl,
	}

	// 定义一个结构体
	#[derive(Debug)]
	struct Programmer< 'skill,'a> {
		name: String,
		skill: [&'skill str; 3],
		sex: Gender,
		age: u8,
		address: &'a str,
	}