Use the Rust Vec Type for Dynamically Expanding Arrays 🦀

Описание к видео Use the Rust Vec Type for Dynamically Expanding Arrays 🦀

In this video, we'll explore the Rust Vec type in the std::vec module. Vec is useful as a dynamically-sized array, and provides many helper methods for adding items, removing items, joining multiple Vec objects together, reserve additional system memory, and more!

There's a vec! macro in Rust that simplifies instantiating a Vec. You can use the .push() method to add items to a mutable Vec. The .append() method on Vec allows you to join another Vec, with the same underlying data type, to itself. The .remove() method will delete an item from a Vec at a specific index. The .reserve() method can be used to reserve extra system memory if a Vec's size will be increased. You can also use .len() and .capacity() methods to monitor the number of items, and reserved size, for a given Vec.

🤯 Rust Programming Playlist 🦀    • Rust Programming Tutorial 🦀  

📖 Rust Vec Type Reference: https://doc.rust-lang.org/std/vec/str...
📖 Using Rust Vec Type: https://doc.rust-lang.org/book/ch08-0...

Visual Studio Code ➡️ https://code.visualstudio.com
Rust Website ➡️ https://rust-lang.org
Rustup Installer ➡️ https://rustup.rs
Rust Docs ➡️ https://doc.rust-lang.org/book

Please follow me on these other social channels!

➡️ https://trevorsullivan.net
➡️ https://github.com/pcgeek86
➡️   / pcgeek86  
➡️    / trevorsullivan  
➡️   / trevorsoftware  
➡️ https://tiktok.com/pcgeek86

All trademarks, logos and brand names are the property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names,trademarks and brands does not imply endorsement.

#rustlang #rust #rustdev #opensource #software #linux #devops #programming #rusty #dev #coding #codinglife #code #coder #ubuntu #ubuntulinux #appdev #developer

Комментарии

Информация по комментариям в разработке