Rust 튜토리얼 목차

The Rust Playground

이 웹사이트에서는 Rust Playground 를 사용하여 온라인에서 직접 실행해 볼 수 있습니다.

우측에서 보다시피 println()도 아닌 println!() 와 같은 코드를 사용하여 stdout에 출력하는 것을 볼 수 있습니다.

! 이것은 매크로 (Macro)라는 Rust 언어의 특별한 기능 중 하나인데 우선은 생김새만 알고 나중에 뭔지 알아보겠습니다.

Rust 언어는 쉽게 작성할 수 있도록 (syntactic sugar) 도와주지만 사실은 컴파일러가 아래처럼 처리합니다.

(cargo inspect 명령어)

#![feature(prelude_import)]

#[prelude_import]
use std::prelude::rust_2018::*;

#[macro_use]
extern crate std;

fn main() {
    {
        ::std::io::_print(format_args!("Welcome to the playground! You can modify the code in here.\n"));
    };
}