Adding initial code for data storage

This commit is contained in:
2022-12-30 15:47:07 -05:00
parent eeae2fe780
commit 7f3f730942
2 changed files with 66 additions and 2 deletions

15
src/checklist.rs Normal file
View File

@@ -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<checklist> {
let all_checklists:Vec<checklist> = {};
return all_checklists;
}

View File

@@ -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<i32>) -> Vec<i32> {
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<checklist> = init_checklists();
}