mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2024-11-09 08:51:18 +08:00
Update ch14-02-publishing-to-crates-io.md
This commit is contained in:
parent
e45eecd1dd
commit
e80e922fc3
@ -1,6 +1,6 @@
|
|||||||
## 将 crate 发布到 Crates.io
|
## 将 crate 发布到 Crates.io
|
||||||
|
|
||||||
> [ch14-02-publishing-to-crates-io.md](https://github.com/rust-lang/book/blob/master/src/ch14-02-publishing-to-crates-io.md) > <br>
|
> [ch14-02-publishing-to-crates-io.md](https://github.com/rust-lang/book/blob/master/src/ch14-02-publishing-to-crates-io.md) <br>
|
||||||
> commit c084bdd9ee328e7e774df19882ccc139532e53d8
|
> commit c084bdd9ee328e7e774df19882ccc139532e53d8
|
||||||
|
|
||||||
我们曾经在项目中使用 [crates.io](https://crates.io)<!-- ignore --> 上的包作为依赖,不过你也可以通过发布自己的包来向它人分享代码。[crates.io](https://crates.io)<!-- ignore --> 用来分发包的源代码,所以它主要托管开源代码。
|
我们曾经在项目中使用 [crates.io](https://crates.io)<!-- ignore --> 上的包作为依赖,不过你也可以通过发布自己的包来向它人分享代码。[crates.io](https://crates.io)<!-- ignore --> 用来分发包的源代码,所以它主要托管开源代码。
|
||||||
@ -111,17 +111,17 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
|
|||||||
```rust,ignore
|
```rust,ignore
|
||||||
//! # Art
|
//! # Art
|
||||||
//!
|
//!
|
||||||
//! 一个描述美术信息的库。
|
//! A library for modeling artistic concepts.
|
||||||
|
|
||||||
pub mod kinds {
|
pub mod kinds {
|
||||||
/// 采用 RGB 色彩模式的主要颜色。
|
/// The primary colors according to the RYB color model.
|
||||||
pub enum PrimaryColor {
|
pub enum PrimaryColor {
|
||||||
Red,
|
Red,
|
||||||
Yellow,
|
Yellow,
|
||||||
Blue,
|
Blue,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 采用 RGB 色彩模式的次要颜色。
|
/// The secondary colors according to the RYB color model.
|
||||||
pub enum SecondaryColor {
|
pub enum SecondaryColor {
|
||||||
Orange,
|
Orange,
|
||||||
Green,
|
Green,
|
||||||
@ -132,8 +132,8 @@ pub mod kinds {
|
|||||||
pub mod utils {
|
pub mod utils {
|
||||||
use crate::kinds::*;
|
use crate::kinds::*;
|
||||||
|
|
||||||
/// 等量的混合两个主要颜色
|
/// Combines two primary colors in equal amounts to create
|
||||||
/// 来创建一个次要颜色。
|
/// a secondary color.
|
||||||
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
|
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
|
||||||
// --snip--
|
// --snip--
|
||||||
# SecondaryColor::Orange
|
# SecondaryColor::Orange
|
||||||
@ -178,7 +178,7 @@ fn main() {
|
|||||||
```rust,ignore
|
```rust,ignore
|
||||||
//! # Art
|
//! # Art
|
||||||
//!
|
//!
|
||||||
//! 一个描述美术信息的库。
|
//! A library for modeling artistic concepts.
|
||||||
|
|
||||||
pub use self::kinds::PrimaryColor;
|
pub use self::kinds::PrimaryColor;
|
||||||
pub use self::kinds::SecondaryColor;
|
pub use self::kinds::SecondaryColor;
|
||||||
|
Loading…
Reference in New Issue
Block a user