릴리즈 프로필을 통한 빌드 커스터마이징하기

# opt-level 설정에 대한 dev와 release 프로필의 기본 설정값
[profile.dev]
opt-level = 0

[profile.release]
opt-level = 3

Crates.io에 크레이트 배포하기

문서화 주석 만들기

/// Adds one to the number given.
///
/// # Examples
///
/// ```
/// let arg = 5;
/// let answer = my_crate::add_one(arg);
///
/// assert_eq!(6, answer);
/// ```
pub fn add_one(x: i32) -> i32 {
    x + 1
}
//! # My Crate
//!
//! `my_crate` is a collection of utilities to make performing certain
//! calculations more convenient.

/// Adds one to the number given.
// --생략--

pub use로 공개 API 내보내기

//! # Art
//!
//! A library for modeling artistic concepts.

pub use self::kinds::PrimaryColor;
pub use self::kinds::SecondaryColor;
pub use self::utils::mix;

pub mod kinds {
    // --생략--
}

pub mod utils {
    // --생략--
}

크레이트에 메타데이터 추가하기

[package]
name = "guessing_game"
version = "0.1.0"
edition = "2021"
description = "A fun game where you guess what number the computer has chosen."
license = "MIT OR Apache-2.0"

[dependencies]

카고 작업공간(workspace)

workspace 생성하기