Easy Rust #13 fancy print


Easy Rust #13 fancy print

println!와 print!의 차이는 new line이 있고 없고의 차이입니다. \n을 넣어줘도 new line이 들어갑니다. 경로를 쓸때와 같이 역슬래시를 많이 넣어줘야 하는 상황이라면 이렇게 써주면 잘 출력됩니다. 이런 식으로도 가능합니다. {:p}는 포인터의 주소를, {:b}는 my_variable의 2진수, {:X}는 16진수를 출력합니다. 파이썬같이 가운데정렬, 왼쪽, 오른쪽정렬, 패딩 등등을 해볼 수 있습니다. 더 많은 내용을 보려면 https://doc.rust-lang.org/std/fmt/ std::fmt - Rust Utilities for formatting and printing String s. This module contains the runtime support for the format! syntax extension. This macro is implemented in the compiler to emit calls to this module in ...


#rust #프로그래밍

원문링크 : Easy Rust #13 fancy print