Slices let you reference a contiguous sequence of elements in a collection rather than the whole collection.
- A string slice is a reference to a part of a screen.…Let's create a new project and call it slices.…(clicking)…Let's cd enter the project.…So let's expand this directory…that Cargo has created for us.…Go to the main.rs…and clear out the print align statement.…We can create slices using arrange within brackets.…Let's first declare a string, double colon, and from.…
(clicking)…So this is a string,…now hello equals ampersand S, zero, dot, dot, five.…We can create slices using arrange within brackets…where the starting index is a first position…included in the slice and the ending index…is one more than the last position,…including in the slice.…
The start dot dot N syntax is arrange…that begins at the start and continues up to…but not including the N.…Now let's see if we can print this value.…(clicking)…so I'll just say hello contains…and a placeholder and fill it up…with the variable, hello.…Let's save this.…Go to command prompt and run this one.…
So as you can see, it starts at the first position…up to the fifth position.…
- Installing Rust
- Data types
- Adjusting memory allocation
- Setting up race conditions
- Working with functions
- Exploring references and borrowing
- Using structs
- Method syntax
- Demonstrating recoverable errors with Result
- Working with enums
- Getting user input
Skill Level Beginner
Programming Foundations: Data Structures (2014)with Simon Allardice2h 29m Intermediate
1. Hello, Rust!
2. Basic Programming Concepts
3. Ownership in Rust
4. Data Handling and Pattern Matching in Rust
5. Error Handling
6. Sample Rust Project: The Guessing Game
Next steps1m 14s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.