본문 바로가기

rust26

[Rust 문서 읽기] 8. Common Collections (일반적인 컬렉션) The Rust Programming Language - Storing Lists of Values with Vectors - A vector allows us to store a variable number of values next to each other - only store values of the same type - useful such as the lines of text in a file or the prices of items in a shopping cart - Creating a New Vector - we add a type annotation b/c when aren't inserting any values into vector (rarely) - vec! macro: creat.. 2023. 2. 11.
[Rust 문서 읽기] 7. Managing Growing Projects with Packages, Crates, and Modules (모듈) The Rust Programming Language - Module System - Packages: A Cargo feature that lets you build, test, and share crates - Crates: A tree of modules that produces a library or executable - Modules and use: Let you control the organization, scope, and privacy of paths - Paths: A way of naming an item, such as a struct, function, or module - Packages and Crates - Crate: the smallest amount of code th.. 2023. 2. 11.
[Rust 문서 읽기] 6. Enums and Pattern Matching (열거형과 패턴 매칭) The Rust Programming Language - Defining an Enum - enum gives us a way of saying a value is one of a possible set of values - Enum Values - we can put data directly into each enum variant - the name of each enum variant that we define also becomes a function that constructs an instance of the enum - each variant can have different types and amounts of associated data - we can put any kind of dat.. 2023. 2. 5.
[Rust 문서 읽기] 5. Using Structs to Structure Related Data (연관된 데이터들을 구조체로 다루기) The Rust Programming Language - Before Start - Struct: custom data type that lets you package together and name multiple related values that make up a meaningful group - Structs and enums are the building blocks for creating new types in your program's domain to take full advantage of Rust's compile-time type checking - Defining and Instantiation Structs - Like tuples, the pieces of a struct can.. 2023. 2. 5.
반응형