diff --git a/src/checklist.rs b/src/checklist.rs new file mode 100644 index 0000000..d8eaf27 --- /dev/null +++ b/src/checklist.rs @@ -0,0 +1,15 @@ +struct list_item { + todo:String, + done:bool, + subtodo:Vec:list_item +} + +struct checklist { + name:String, + todo_list:Vec:list_item +} + +fn init_checklists() -> Vec { + let all_checklists:Vec = {}; + return all_checklists; +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..c5ca57e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,52 @@ -fn main() { - println!("Hello, world!"); + +fn test_by_ref(my_num:&mut u8) { + *my_num = 26; +} + +fn test_hello(my_num:u16) -> u16 { + println!("Your num {}", my_num); + return 522; +} + +fn display(my_string:&mut String) { + println!("My string {}", *my_string); +} + +fn display_vec(my_vec:Vec) -> Vec { + println!("inside display vec: {:?}", my_vec); + return my_vec; +} + +fn main() { + let company:&'static str = "Whoot mate"; + let empty_string = String::new(); + let content_string = String::from("my string whee"); + + let mut test_int:u8 = 8; + + test_int += 5; + println!("Hello, world! {}", test_int); + println!("Hollo {} welcome", company); + println!("length of empty is {}", empty_string.len()); + println!("length of from is {}", content_string.len()); + println!("length of static is {}", company.len()); + + + if test_int > 5 { + println!("Is greater"); + } + + println!("Running away now : {}", test_hello(test_int.into())); + test_by_ref(&mut test_int); + println!("test int = {}", test_int); + + let mut test_str:String = String::from("Whats up doc"); + display(&mut test_str); + println!("outside {}", test_str); + + let mut my_vec = vec![1,2,4]; + my_vec = display_vec(my_vec); + println!("{:?}", my_vec); + + let _mylist:Vec = init_checklists(); }