본문 바로가기

분류 전체보기293

[Rust] Command Line Program 제작 : 환경변수 활용 (29일차) // 지난 lib.rs 코드를 이어서 수정. 아래 명령어를 입력해보자 // $cargo run to poem.txt // $CASE_INSENSITIVE=1 cargo run to poem.txt use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::env; pub struct Config { pub query: String, pub filename: String, pub case_sensitive: bool, } impl Config { pub fn new(args: &[String]) -> Result(query: &str, contents: &'a str) -> Vec(query: &str, contents: &'a .. 2023. 1. 11.
[MySQL] DISTINCT 조회 Data 중복 없이 조회 SELECT DISTINCT [Column 이름] FROM [Table 이름]; SELECT DISTINCT 'index' FROM 'people' https://blog.naver.com/PostView.naver?blogId=tang1013&logNo=222291646107&parentCategoryNo=&categoryNo=51&viewDate=&isShowPopularPosts=true&from=search 2023. 1. 11.
[Rust] Command Line Program 제작 (28일차) // Cargo.toml 과 동일한 위치의 최상단 경로에 poem.txt 생성 I'm nobody! Who are you? Are you nobody, too? Then there's a pair of us — don't tell! They'd banish us, you know. How dreary to be somebody! How public, like a frog To tell your name the livelong day To an admiring bog! // $cargo run the poem.txt 명령어를 입력하여 실행 use std::env; use std::fs::File; use std::io::prelude::*; fn main() { let args: Vec = env::arg.. 2023. 1. 10.
[Rust] Testing 예제_2 (27일차) fn prints_and_returns_10(a: i32) -> i32 { println!("I got the vaue {}", a); 10 } #[cfg(test)] mod tests { use super::*; #[test] fn this_test_will_pass() { let value = prints_and_returns_10(4); assert_eq!(10, value); } #[test] fn this_test_will_fail() { let value = prints_and_returns_10(8); assert_eq!(5, value); } } pub fn add_two(a: i32) -> i32 { a + 2 } #[cfg(test)] mod tests { use super::*; #[.. 2023. 1. 9.