Write one program examlayout1.rsthat, for each of the following types, creates a value of that type and then prints it:vec

WRITING CODE
When you are asked to write a program in the questions below, you should write one Rust source code file that lives in the code/plain/src/bin/ directory, has a mainfunction, and can be run with cargo run –bin foo (where foo.rs is the name of the Rust source code file). Do not use any additional crates in your solutions.
QUESTION: DATA LAYOUT
Write one program examlayout1.rsthat, for each of the following types, creates a value of that type and then prints it:Vec
&[u8]
Box
Box
Box
Box
Box<Box>
Box
[Box; 4]
[Option; 4]
Vec
Use Debug formating with {:?}) to print each value. Your program must have a main function.
For each of the following types, draw a diagram to illustrate the data layout in memory when a local variable x contains a value of that type.&[u8]
Box
Box
Vec
You can draw your answers on paper, take photos, and include them in your PDF.
Write one program examlayout2.rsthat, for each of the following types, creates a value of that type and then prints out all of the memory addresses used to store the value. In particular, your program should print out the memory addresses used on the stack and on the heap. You must print out the memory addresses, and you can print out the contents of those memory addresses if you like.Box
Vec

Write one program examlayout2.rs that, for each of the following types, creates a value of that type and then prints out all of the memory addresses used to store the value.

Writing Code
When you are asked to write a program in the questions below, you should write one Rust source code file that lives in the code/plain/src/bin/ directory, has a mainfunction, and can be run with cargo run –bin foo (where foo.rs is the name of the Rust source code file). Do not use any additional crates in your solutions.
Question: Data Layout
Write one program examlayout1.rs that, for each of the following types, creates a value of that type and then prints it:Vec
&[u8]
Box
Box
Box
Box
Box<Box>
Box
[Box; 4]
[Option; 4]
Vec
Use Debug formating with {:?}) to print each value. Your program must have a main function.
For each of the following types, draw a diagram to illustrate the data layout in memory when a local variable x contains a value of that type.&[u8]
Box
Box
Vec
You can draw your answers on paper, take photos, and include them in your PDF.
Write one program examlayout2.rs that, for each of the following types, creates a value of that type and then prints out all of the memory addresses used to store the value. In particular, your program should print out the memory addresses used on the stack and on the heap. You must print out the memory addresses, and you can print out the contents of those memory addresses if you like.Box
Vec

Write a simple interactive program examinter.rs that plays a very simple text adventure game with the user.

Writing Code
When you are asked to write a program in the questions below, you should write one Rust source code file that lives in thecode/plain/src/bin/ directory, has a main function, and can be run with cargo run –bin foo (where foo.rs is the name of the Rust source code file). Do not use any additional crates in your solutions.
Question: File/Strings
Write a program examfile.rs that opens a file and prints out the lines of the file (with line numbers) if the line contains “the” (lowercase only). The file to open should be given as the first command-line argument to your program. The line numbers printed should be the original line numbers in the file, before restricting to the lines containing “the”.Your output should be equivalent to running cat -n | grep the. That is, suppose the file examfile.txt contains:the rain
in spain
falls
mainly
on the
plain
Then your output should be the same as:$ cat -n examfile1.txt | grep the
1 the rain
5 on the
(you do not need to worry about padding numbers or anything like that; just put two spaces between the line number and the line text).
Question: Simple Interactive Program
Write a simple interactive program examinter.rs that plays a very simple text adventure game with the user. If you are unfamiliar with text adventure games, play Zork online for a few minutes. Your adventure game should have at least four locations, and the user should be able to go between them using go north, go south, go east, go west, etc. if the locations are connected in that direction. Your program should print a description of the location whenever you enter that location (via a go command). Hints: number each location; store the location descriptions in, say, a Vec; number each direction (e.g., 0 is North, 1 is East, etc.) and then have a paths:Vec<[Option;4]> structure that stores whether or not there is a path leading from a location and which location it goes to, i.e., paths[i][d] = Some(j) if you can go in direction dfrom location i and end up in location j; and paths[i][d] = None if you cannot go in direction d from location i.

Learning Goal: I’m working on a rust question and need an explanation and answer

Learning Goal: I’m working on a rust question and need an explanation and answer to help me learn.1- Using one of the programming languages presented by your classmates, e.g., Go, Scala, Dart, TypeScript, Swift, Rust, etc., implement the dining philosopher (https://en.wikipedia.org/wiki/Dining_philosophers_problem) program using a multi-thread program (concurrency).Provide the instructions (step by step) that would allow the instructor to execute your program.2- Using one of the programming languages presented by your classmates, e.g., Go, Scala, Dart, TypeScript, Swift, Rust, etc., implement the singleton pattern (https://www.tutorialspoint.com/design_pattern/singleton_pattern.htm). Make sure you also provide a testing function (or program) allowing the instructor to test your implementation.Provide the instructions (step by step) that would allow the instructor to execute your program.3- Using one of the programming languages presented by your classmates, e.g., Go, Scala, Dart, TypeScript, Swift, Rust, etc., implement the merge sort algorithm (https://en.wikipedia.org/wiki/Merge_sort). Your implementation must take advantage of recursive functions. You shall classify in ascending order 1000 integer numbers created by a random function.Provide the instructions (step by step) that would allow the instructor to execute your program.
Requirements: 3 answers to 3 questtons   |   .doc file