본문 바로가기

전체 글369

Rust 의 await, Future, Poll 에 대해 Rust는 비동기 프로그래밍을 위해 async/await 문법을 제공합니다. async 함수는 비동기 코드 블록을 나타내며, await 키워드를 사용하여 비동기 호출을 기다리고 결과를 반환할 수 있습니다. Future는 Rust에서 비동기 작업을 표현하는 trait입니다. Future를 구현하는 타입은 작업이 완료될 때까지 실행을 일시 중지하고 결과를 제공할 수 있습니다. Future는 poll 메소드를 구현해야 합니다. 이 메소드는 작업이 아직 완료되지 않았거나 작업이 완료되었지만 결과가 아직 사용 가능하지 않은 경우 Poll::Pending을 반환하고, 작업이 완료되고 결과를 제공할 수 있는 경우 Poll::Ready를 반환합니다. 다음은 간단한 예시 코드입니다: use futures::Future;.. 2023. 3. 24.
추천: 외부모니터 밝기제어 Mac 무료앱 : MonitorControl - for Apple Silicon and Intel https://github.com/MonitorControl/MonitorControl https://github.com/MonitorControl/MonitorControl/releases 2023. 3. 23.
추천 무료 맥앱 stats : macOS system monitor in your menu bar https://github.com/exelban/stats brew install stats https://github.com/exelban/stats/releases/download/v2.8.13/Stats.dmg GitHub - exelban/stats: macOS system monitor in your menu bar macOS system monitor in your menu bar. Contribute to exelban/stats development by creating an account on GitHub. github.com 2023. 3. 23.
Google 스타일 가이드 https://google.github.io/styleguide/ Google Style Guides Style guides for Google-originated open-source projects google.github.io AngularJS 스타일 가이드 일반적인 Lisp 스타일 가이드 C + + 스타일 가이드 C # 스타일 가이드 스타일 가이드 HTML / CSS 스타일 가이드 자바 스크립트 스타일 가이드 자바 스타일 가이드 Objective-C 스타일 가이드 파이썬 스타일 가이드 R 스타일 가이드 쉘 스타일 가이드 스위프트 스타일 가이드 TypeScript 스타일 가이드 Vim 스크립트 스타일 가이드 2023. 3. 23.
추천: MAC 맥 개발자를 위한 설치 프로그램 이번에 맥 초기화 / 셋팅하면서 설치했던 앱들 정리, 무료/개발용으로 잘 사용하고 있는 것들. 하나씩 적었는데, 내용 bottom 에 가면 brew 랑, zshrc 전체 내용이 있습니다 맥초기화 셋팅 - 설치 프로그램 sudo spctl —master-disable fuzzy finder : command search 자동완성 -> 커맨드 일부만 치고 Ctrl+r brew install fzf add ~/.zshrc [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh bat -> syntax 추가된 cat brew install bat add ~/.zshrc alias cat='bat --paging=never' vim brew install neovim add ~/.zshrc alia.. 2023. 3. 21.
Rust match match는 Rust에서 패턴 매칭을 수행하는 키워드입니다. 다른 언어에서는 switch와 유사한 기능을 수행합니다. 다른 언어의 switch문과 비교하여 Rust의 match문의 가장 큰 차이점은 각 분기(branch)마다 변수나 값에 대한 패턴을 지정할 수 있다는 것입니다. 이것은 Rust에서 매우 강력한 기능으로 여겨집니다. 다음은 Rust에서 match를 사용한 예제 코드입니다. let number = 5; match number { 0 => println!("Number is zero"), 1 => println!("Number is one"), 2..=10 => println!("Number is between two and ten"), _ => println!("Number is someth.. 2023. 3. 16.
Rust 매크로 macro_rules! Rust의 macro_rules! 매크로는 코드를 생성하는 Rust 코드의 일부입니다. 이 매크로를 사용하면 사용자 지정 매크로를 작성하여 Rust 코드의 작성과 유지 관리를 단순화할 수 있습니다. macro_rules! 매크로는 Rust 코드에서 기호 또는 패턴을 식별하고 이러한 패턴에 대해 매크로를 적용하는 방법을 지정합니다. 예를 들어, 이 매크로를 사용하여 새로운 함수를 생성할 수 있습니다. macro_rules! make_a_function { ($func_name: ident) => ( fn $func_name() { println!("Hello from {} function!", stringify!($func_name)); } ) } make_a_function!(my_function); f.. 2023. 3. 15.
Rust trait - 인터페이스?, 추상클래스? Rust에서 Trait은 다른 언어에서 인터페이스나 추상 클래스와 비슷한 역할을 합니다. Trait은 메서드와 관련된 동작을 정의하며, 구조체, 열거형, 또는 다른 Trait 등과 함께 사용될 수 있습니다. Trait을 사용하여 코드를 더 모듈화하고, 코드 재사용성을 높이고, 다형성을 제공할 수 있습니다. 다음은 간단한 예제입니다. 이 예제에서는 Trait을 사용하여 구조체가 지정된 Trait에 해당하는 메서드를 구현할 수 있도록합니다. trait Animal { fn name(&self) -> &'static str; fn make_sound(&self); } struct Dog { name: &'static str, } struct Cat { name: &'static str, } impl Anima.. 2023. 3. 14.
zsh 설치/셋팅하기 - install, setting zsh이 좋은점 : tab 자동완성, 제안(Ctrl + r), 프롬프트 install zsh, oh-my-zsh, zsh-syntax-highlighting $ sudo apt install zsh && \ chsh -s `which zsh` && \ sudo apt install zsh-syntax-highlighting && \ echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc && \ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh config zsh edit theme and add plug.. 2023. 3. 13.