본문 바로가기

Personal-Study/Rust11

[Rust 문서 읽기] 9. Error Handling (예외 처리) The Rust Programming Language - Recoverable and Unrecoverable errors - recoverable error - ex) file not found error - type Result - unrecoverable error - ex) index out of range, ... - symptoms of bugs - immediately stop the program - Rust doesn't have exceptions - panic! macro that stops execution when the program encounters an unrecoverable error - Unrecoverable Errors with panic! - Using a pan.. 2023. 2. 18.
[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.
반응형