Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust 2018 已经发布...但它是到底什么呢? #4992

Merged
merged 4 commits into from
Jan 21, 2019
Merged

Rust 2018 已经发布...但它是到底什么呢? #4992

merged 4 commits into from
Jan 21, 2019

Conversation

CoolRice
Copy link
Contributor

译文翻译完成,resolve #4899

@CoolRice
Copy link
Contributor Author

有些内容比如 borrow checker 真没看懂,可能翻译的不准确,建议有 Rust 经验的人来校对

@leviding leviding changed the title finish translation of rust-2018-is-here-but-what-is-it.md Rust 2018 已经发布...但它是到底什么呢? Jan 15, 2019
@ghost
Copy link

ghost commented Jan 17, 2019

有些内容比如 borrow checker 真没看懂,可能翻译的不准确,建议有 Rust 经验的人来校对

其实是 Rust 的一种机制而已,Rust 内置 Memory safety(内存安全)机制,我拿生活中的事情来举个例子:

小明和小红是好朋友。小红有个非常好用的钢笔。现在小明想试一试这个笔。现在会有几种可能:
小红:你拿着看看吧,到时候还给我(move)
小红:你自个买一个去(copy)

如果走第一个分支,小明就从小红那里借到了笔(borrow)
小红:你看看行,别瞎划拉( immutable borrow)
小红:咱们这关系,你可以随便用(mutable borrow)

引用资料:http://f.dataguru.cn/article-9100-1.html

说实话,我也不大懂 Rust 😅就是感觉直接扔一篇文章在这里不大好😂求指正~

更正:borrow checker 是借用检查器,我之前以为是两个词呢~

@ghost
Copy link

ghost commented Jan 17, 2019

@leviding 校对认领

ps:我对 Rust 也不甚了解,有些特别深入的东西可能不会很准确~

@fanyijihua
Copy link
Collaborator

@IceyTea 好的呢 🍺

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CoolRice @leviding 粗略校对完成。
作为一个初学者,感觉有些东西理解修改的还不是很到位。
最大的感觉:如果自己读的话,意思差不多就可以了,但是真的要是想写一篇文章,具体的要求就高了,还要考虑措辞严谨、语句通顺啥的~
对 Rust 的理解也不是很深刻(幸亏这是一个介绍性的文章),导致有些意思不到位,可能还会有错误的地方。

@CoolRice 文章翻译大意完整,可以理解表达含义。

review 里面有()的代表原文没有,但补充进去读起来更顺的内容

> * 校对者:

# Rust 2018 is here… but what is it?
# Rust 2018 已经发布……但它是到底什么呢?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『但它是到底什么呢』=>『但它到底是什么呢』


**This post was written in collaboration with the Rust Team (the “we” in this article). You can also read [their announcement](https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html) on the Rust blog.**
**本文是与 Rust 团队(指文中的“我们”)合著。你也可在 Rust 博客上阅读[他们的声明](https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html)**
Copy link

@ghost ghost Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『是与 Rust 团队(指文中的“我们”)合著』=>『是与 Rust 团队(指文中的“我们”)的合著』

后面补充了个『的』字


If you have existing Rust code and you want it to use Rust 2018, you’ll very likely need to update it for these new module paths. But that doesn’t mean that you’ll need to manually update your code. Run `cargo fix` before you add the edition specifier to Cargo.toml and `rustfix` will make all the changes for you.
如果你有现有的 Rust 代码并且希望它使用 Rust 2018,那么你很可能需要为这些新的模块路径更新它。但这并不意味着你需要手动更新代码。在将版本说明符添加到 Cargo.toml 之前运行 `cargo fix` ,并且 `rustfix` 会为你进行所有更改。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『现有的 Rust 代码』=>『现存的 Rust 代码』
『这并不意味着』=>『那并不意味着』
『并且 rustfix 会为你进行所有更改』=>『并且运行 rustfix 会为你进行所有更改』


We’ve made this more explicit. Now, if you want to refer to the crate root, you use the prefix `crate::` instead. And this is just one of the [path clarity](https://rust-lang-nursery.github.io/edition-guide/rust-2018/module-system/path-clarity.html) improvements we’ve made.
我们已经明确了这一点。现在,如果要引用包的根路径,则使用前缀crate::。这只是我们所做的 [path clarity](https://rust-lang-nursery.github.io/edition-guide/rust-2018/module-system/path-clarity.html) 改进之一。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『前缀crate::』=>『前缀 crate::

中英文之间需要增加空格

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『这只是我们所做的 [path clarity] 改进之一』=>『这只是我们在(路径清晰) [path clarity] 方面所做的改进之一』

。。。我在想,不加圆角括号里面的中文可能会更好些?不大确定。。。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『这只是我们所做的 [path clarity] 改进之一』=>『这只是我们在(路径清晰) [path clarity] 方面所做的改进之一』

。。。我在想,不加圆角括号里面的中文可能会更好些?不大确定。。。

这个大概算算有名词了吧,我觉得保留原样比较好

impl serde::Serialize for OtherType { ... }
}
```

Another example is the prefix `::`, which used to refer to either the crate root or an external crate. It could be hard to tell which.
另一个例子是前缀`::`,用于指代包的根目录或外部包。可能很难辨别。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『另一个例子是前缀::,用于指代包的根目录或外部包。可能很难辨别。』=>『另一个例子是前缀 :: ,它被用来指代当前包的根目录或一个外部包,这(两种情况)可能很难被(使用者)区分。


Rust editions are different. This is because of the way the language is evolving. Almost all of the new features are 100% compatible with Rust as it is. They don’t require any breaking changes. That means there’s no reason to limit them to Rust 2018 code. New versions of the compiler will continue to support “Rust 2015 mode”, which is what you get by default.
Rust 的版本则不同。这是因为语言的进化的方式不同。几乎所有新功能都会 100% 兼容原有的 Rust。他们不需要重大的更新。这意味着不需要把他们限制在 Rust 2018 代码中。新版本的编译器会继续支持“Rust 2015 模式”,也就是你默认使用的模式。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『进化』=>『演进』

这个不调整也无所谓


But sometimes to advance the language, you need to add things like new syntax. And this new syntax can break things in existing code bases.
然而因为有时候要改进语言,你必须添加新的东西像新语法。并且这类新语法会在老的代码库下执行失败。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『像新语法』=>『(像新语法)』

加个括号,看着更清晰些。。。


[![](https://2r4s9p1yi1fa2jd7j43zph8r-wpengine.netdna-ssl.com/files/2018/12/01_03-crate-graph-500x330.png)](https://2r4s9p1yi1fa2jd7j43zph8r-wpengine.netdna-ssl.com/files/2018/12/01_03-crate-graph.png)

Because of this, even once Rust 2018 is out there, it’s mostly going to look the same as Rust 2015. Most changes will land in both Rust 2018 and Rust 2015. Only the handful of features that require breaking changes won’t pass through.
因此,即使 Rust 2018 已经出现,它大致看起来与 Rust 2015 相同。大多数变化都将出现在 Rust 2018 Rust 2015 中。只有少数需要重大变化的功能不会通过。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『都将出现在』=>『都将同时出现在』

『功能不会通过。』=>『功能不会同步支持。』


[![](https://2r4s9p1yi1fa2jd7j43zph8r-wpengine.netdna-ssl.com/files/2018/12/01_06-as_this-500x463.png)](https://2r4s9p1yi1fa2jd7j43zph8r-wpengine.netdna-ssl.com/files/2018/12/01_06-as_this.png)

In our minds, it’s the second. So let’s look at all that happened outside of the core language. Then we can dive into the core language itself.
在我们看来,这是第二个。让我们来看看核心语言之外的所有事情。然后我们可以深入研究核心语言本身。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『第二个』=>『第二点』
『来看看』=>『先来看看』

倒数第二个句号可以替换为逗号


Rust 2018 is a push to make Rust developers more productive. Many productivity wins come from things outside of the core language… things like tooling. They also come from focusing on specific use cases and figuring out how Rust can be the most productive language for those use cases.
Rust 2018 提高了 Rust 开发人员的工作效率。许多生产力的提高来自核心语言以外的东西……比如工具。他们还专注于特定用例,并弄清楚 Rust 如何成为这些用例最有效的语言。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『提高了 Rust 开发人员的工作效率。』=>『致力于提高 Rust 开发人员的工作效率。』

push (n) 推,决心; 大规模攻势; 矢志的追求。感觉『致力于』这个地方写『决心于』有点奇怪,但是又找不到啥词来形容~

@leviding leviding added the enhancement 等待译者修改 label Jan 18, 2019
@CoolRice
Copy link
Contributor Author

@IceyTea ,已根据建议更改,不过有一部分我有点异议,麻烦看下评论。

@ghost
Copy link

ghost commented Jan 21, 2019

@IceyTea ,已根据建议更改,不过有一部分我有点异议,麻烦看下评论。

好的 👍

ghost
ghost previously approved these changes Jan 21, 2019
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CoolRice ,有两个小地方需要调整,请查看下 🌹

之前的异议,完全同意你的写法 👍


使用[`web-sys` 和 `js-sys` crates](https://rustwasm.github.io/2018/09/26/announcing-web-sys.html),很容易在 Rust 代码调用类似于 `fetch` 或 `appendChild` 的 Web API 。并且 `wasm-bindgen` 可以轻松支持 WebAssembly 原生不支持的高级数据类型。

一旦编写了 Rust WebAssembly 模块,就可以使用各种工具将其嵌入到 Web 应用程序的其余部分中。你可以使用 [wasm-pack](https://github.com/rustwasm/wasm-pack) 自动运行这些工具,并根据需要将新模块推送到 npm。

Check out the [Rust and WebAssembly book](https://rustwasm.github.io/book/) to try it yourself.
查看 [Rust 嵌入式书籍](https://rust-embedded.github.io/book/),建议你自己尝试一下
建议你查看 [Rust 嵌入式书籍](https://rust-embedded.github.io/book/)并自己亲自尝试一下
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『并自己亲自尝试一下』=>『并亲自尝试一下』

『自己』和『亲自』表意有重复


Rust 的版本则不同。这是因为语言的进化的方式不同。几乎所有新功能都会 100% 兼容原有的 Rust。他们不需要重大的更新。这意味着不需要把他们限制在 Rust 2018 代码中。新版本的编译器会继续支持“Rust 2015 模式”,也就是你默认使用的模式。
Rust 的版本则不同。这是因为语言的演进的方式不同。几乎所有新功能都会 100% 兼容原有的 Rust。他们不需要重大的更新。这意味着不需要把他们限制在 Rust 2018 代码中。新版本的编译器会继续支持“Rust 2015 模式”,也就是你默认使用的模式。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『语言的演进的方式』=>『语言演进的方式』

『演进』前后两个『的』重复


有了这些变化,Rust 的嵌入式开发将从有风险的前沿迈向高效。

查看 [Rust 嵌入式书籍](https://rust-embedded.github.io/book/),建议你自己尝试一下
建议你查看 [Rust 嵌入式书籍](https://rust-embedded.github.io/book/)并自己亲自尝试一下
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『并自己亲自尝试一下』=>『并亲自尝试一下』

『自己』和『亲自』表意有重复


不过这个只在现在的 Rust 2018 可以使用,而不远的将来所有版本都将可以使用。快会我很会写关于这部分的更多内容
不过当前这个特性只支持在 Rust 2018 中使用,而不远的将来,所有 Rust 版本都将可以使用。之后我很会写更多关于这部分的内容
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『而不远的将来』=>『而在不远的将来』

@CoolRice
Copy link
Contributor Author

@IceyTea,感谢感谢,已更新

@leviding leviding added 标注 待管理员 Review and removed enhancement 等待译者修改 校对认领 labels Jan 21, 2019
@leviding leviding merged commit b05e095 into xitu:master Jan 21, 2019
@leviding
Copy link
Member

@CoolRice 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。

掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件
专栏地址:https://zhuanlan.zhihu.com/juejinfanyi

@leviding leviding added 翻译完成 and removed 标注 待管理员 Review 正在校对 labels Jan 21, 2019
@CoolRice
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust 2018 已经发布...但它是到底什么呢?
4 participants