Giter VIP home page Giter VIP logo

rust-by-example-cn's Issues

函数章节问题

  • 闭包(fn/closures) - 考虑将代码中的注释外移,此处链接标记无效。不过也存在解释位置的问题,这需要考虑。

image

  • std 中的例子(fn/closures/closure_examples) - 奇怪的高亮,对比标记并没有什么不一样的地方。内容无内容,只是追求英文版一般的行内代码块高亮。

image

  • Iterator::find(fn/closures/closure_examples/iter_find) - 更新 | 这个“谓词”是看不懂...

image

match例子不能编译通过

rust-by-example-cn/src/flow_control/match.md

···
match number {
        // 匹配单个值
        1 => println!("One!"),
        // 匹配多个值
        2 | 3 | 5 | 7 | 11 => println!("This is a prime"),
        // 匹配一个闭区间范围
        13...19 => println!("A teen"),
        // 处理其他情况
        _ => println!("Ain't special"),
    }
···

应为为:

···
match number {
        // 匹配单个值
        1 => println!("One!"),
        // 匹配多个值
        2 | 3 | 5 | 7 | 11 => println!("This is a prime"),
        // 匹配一个闭区间范围
        13..=19 => println!("A teen"),
        // 处理其他情况
        _ => println!("Ain't special"),
    }
···

18.4.4缺少dyn 关键词

在18.4.4中
type Result = std::result::Result<T, Boxerror::Error>;
应该是type Result = std::result::Result<T, Box>;

9.2.6.1 Iterator::any对数组的into_iter()解构出也应该是i32

源代码:

   let array1 = [1, 2, 3];
    let array2 = [4, 5, 6];

    // 对数组的 `iter()` 举出 `&i32`。
    println!("2 in array1: {}", array1.iter().any(|&x| x == 2));
    // 对数组的 `into_iter()` 通常举出 `&i32`。
    println!("2 in array2: {}", array2.iter().any(|&x| x == 2));

正确代码:

   let array1 = [1, 2, 3];
    let array2 = [4, 5, 6];

    // 对数组的 `iter()` 举出 `&i32`。
    println!("2 in array1: {}", array1.iter().any(|&x| x == 2));
    // 对数组的 `into_iter()` 通常举出 `i32`。
    println!("2 in array2: {}", array2.into_iter().any(|x| x == 2));

3.1. 结构体 代码示例问题

中文翻译文档代码段:

// 结构体可以作为另一个结构体的字段
#[allow(dead_code)]
struct Rectangle {
    p1: Point,
    p2: Point,
}

英文文档代码:

// Structs can be reused as fields of another struct
#[allow(dead_code)]
struct Rectangle {
    // A rectangle can be specified by where the top left and bottom right
    // corners are in space.
    top_left: Point,
    bottom_right: Point,
}

问题:中文翻译Rectangle p1 p2 字段未能表达出长方形点的释义,动手试一试例题无法开展

链接可访问性

expression 章节,wike 可访问性在此处不合适。可以选择替换,或者参照当前原文更新内容,去除链接。

image

流程控制章节问题

部分问题我无法处理,只能在此说明。

  • flow_control/match/destructuring/destructure_tuple - 内容更新(可选)

更新内容当中展示了 .. 的使用,于是我记下来了。

  • flow_control/while - 链接可访问性问题
    image

  • flow_control/match - 内容需要更新,去除多出的字
    image

  • flow_control/match/destructuring/destructure_pointers - 补充参考链接
    image

  • flow_control/match/binding - 翻译可能存在问题(不确定)
    image

From Into描述问题

如果我们能够从类型 A 得到类型 B,那么很容易相信我们也能把类型 B 转换为类型 A。
应该更正:
如果我们能够从类型 A 得到类型 B,那么很容易相信我们也能把类型 A 转换为类型 B。

Translation error

您好,在FromInto一节内容中的第一段后半部分原文为:If you are able to convert type A from type B, then it should be easy to believe that we should be able to convert type B to type A. 应该都是再说B转换到A,我认为翻译为:如果我们能够从类型B得到类型A,那么很容易相信我们也能把类型B转换为类型A。会更加合理。望采纳。

Translate advice

The enum keyword allows the creation of a type which may be one of a few different variants.

这句中 variant 可翻译为变种。

mdbook v0.2.0 build出错?

$ git clone https://github.com/rust-lang-cn/rust-by-example-cn
$ cd rust-by-example-cn
$ cargo install mdbook
$ mdbook --version
mdBook v0.2.0
$ mdbook build
2018-08-22 22:28:57 [WARN] (mdbook::config): It looks like you are using the legacy book.toml format.
2018-08-22 22:28:57 [WARN] (mdbook::config): We'll parse it for now, but you should probably convert to the new format.
2018-08-22 22:28:57 [WARN] (mdbook::config): See the mdbook documentation for more details, although as a rule of thumb
2018-08-22 22:28:57 [WARN] (mdbook::config): just move all top level configuration entries like title, author and
2018-08-22 22:28:57 [WARN] (mdbook::config): description under a table called [book], move the destination entry
2018-08-22 22:28:57 [WARN] (mdbook::config): from [output.html], renamed to build-dir, under a table called
2018-08-22 22:28:57 [WARN] (mdbook::config): [build], and it should all work.
2018-08-22 22:28:57 [WARN] (mdbook::config): Documentation: http://rust-lang-nursery.github.io/mdBook/format/config.html
2018-08-22 22:28:57 [INFO] (mdbook::book): Book building has started
2018-08-22 22:28:57 [INFO] (mdbook::book): Running the html backend
$ mdbook serve
打开后的页面是没有css的,打开console看到
book.css store.js 404以及book.js中有报错

Iterator::any, F: FnMut(Self::Item) -> bool {}

    F: FnMut(Self::Item) -> bool {}
    
    // 译注:原文说 `Self::Item` 表明变量是通过值传递给闭包的,这是说错了。
    // `FnMut` 就表示闭包只能通过引用捕获变量。把类型为 `T` 的变量作为闭包
    // 的参数不代表闭包会拿走它的值,也可能是拿走它的引用。

个人认为原文说得没错。FnMut只是针对该函数的捕获。但是下面的例子也表明了,值和引用都可以作为参数。

5.4. 别名#[allow(non_camel_case_types)]

5.4. 别名

// 通过这个属性屏蔽警告。
#[allow(non_camel_case_types)]
type u64_t = u64;
// 试一试 ^ 移除上面那个属性

请问移除此属性变化是什么呢,我不管注不注释#[allow(non_camel_case_types)]都是输出5 nanoseconds + 2 inches = 7 unit?
请问这是为什么呢

翻译建议

7.2.1嵌套循环和标签 里面,下面这个句子似乎不太通顺

并且标签必须给 break/continue 语句通过(the label must be passed to the break/continue statement.)

感觉pass应该翻译成传递更合适

并且标签必须传递给break/continue 语句。

编译pdf报错了

➜  rust-by-example-cn git:(master) ✗ make pdf
node_modules/.bin/gitbook pdf stage
(node:3132) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Starting build ...
Need to install ebook-convert from Calibre
make: *** [pdf] Error 255
➜  rust-by-example-cn git:(master) ✗ node -v
v6.9.5

我不想把node版本降版本为v5.xx。该怎么解决这个问题?

谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.