ABOUT ME

SHOW ME THE CODE


$: cat author.rs
fn main() {
	// Create an instance
	let engineer = Programmer {
		// String type content variable
		name: String::from("Leon Ding"), 
		// An array of a string type with a length of 3
		skill: ["C","Java","Go","Rust","JavaScript","Linux"], 
		// Limit parameter type through enumeration
		sex: Gender::Boy, 
		age: 22,
		address: "Shanghai",
	};

	println!("engineer = {:?}",engineer);
}
		
// Metropolitanization limit range
#[derive(Debug)]
enum Gender {
	Boy,
	Girl,
}

// Define a structure
#[derive(Debug)]
struct Programmer< 'skill,'a> {
	name: String,
	skill: [&'skill str; 6],
	sex: Gender,
	age: u8,
	address: &'a str,
}
						

The Macintosh Finder, Version 1.0 (18 Jan 84)

© 1984 Apple Computer