본문 바로가기

Personal-Study/Rust11

[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.
[Rust 문서 읽기] 4. Understanding Ownership (소유권 이해하기) The Rust Programming Language - Ownership concept enables Rust to make memory safety guarantees without needing a G.C - What is Ownership? - Ownership is a set of rules that govern how a Rust program manages memory - memory is managed through a system of ownership with a set of rules that the compiler checks - None of the features of ownership will slow down your program while it's running - kee.. 2023. 1. 29.
[Rust 문서 읽기] 3. Common Programming Concepts (보편적인 프로그래밍 개념) The Rust Programming Language - Variables and Mutability - By default, variables are immutable -> safety & easy concurrency advantages - Adding mut in front of the variable name makes variable from immutable to mutable - constants - not allowed to use mut keyword with constants - always immutable - using the const keyword to make constants instead of let keyword - the type of the value must be a.. 2023. 1. 29.
[Rust 문서 읽기] 2. Programming a Guessing Game (추리 게임 튜토리얼) The Rust Programming Language - 1~100 random number generated and then user guess the number, after that computer checks if correct or not and gives high/low hint - Processing a Guess use rand::Rng; use std::cmp::Ordering; use std::io; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1..=100); loop { println!("Please input your guess."); let mut guess =.. 2023. 1. 29.
반응형