docs.rs now allows you to choose your build targets | Rust Blog

栏目: IT技术 · 发布时间: 4年前

内容简介:Recently,By default, docs.rs builds all crates published toThis feature allows you to request building only on specific targets. For example,

Recently, docs.rs added a feature that allows crates to opt-out of building on all targets. If you don't need to build on all targets, you can enable this feature to reduce your build times.

What does the feature do?

By default, docs.rs builds all crates published to crates.io for every tier one target . However, most crates have the same content on all targets. Of the platform-dependent crates, almost all target a single platform, and do not need to be built on other targets. For example, winapi only has documentation on the x86_64-pc-windows-msvc and i686-pc-windows-msvc targets, and is blank on all others.

This feature allows you to request building only on specific targets. For example, winapi could opt into only building windows targets by putting the following in its Cargo.toml :

[package.metadata.docs.rs]
# This also sets the default target to `x86_64-pc-windows-msvc`
targets = ["x86_64-pc-windows-msvc", "i686-pc-windows-msvc"]

If you only need a single target, it's even simpler:

[package.metadata.docs.rs]
# This sets the default target to `x86_64-unknown-linux-gnu`
# and only builds that target
targets = ["x86_64-unknown-linux-gnu"]

See the docs.rs documentation for more details about how to opt-in.

How does this help my crate?

Instead of building for every tier-one target, you can build for only a single target, reducing your documentation build times by a factor of 6. This can especially help large crates or projects with many crates that take several hours to document.

How does this help docs.rs?

Building all crates from crates.io can take a long time! Building fewer targets will allow us to reduce wait times for every crate. Additionally, this will decrease the growth of our storage costs, improving the sustainability of the project.

Possible future changes

We're considering turning this on by default in the future; i.e. only building for one target unless multiple targets are specifically requested. However, we don't want to break anyone's documentation, so we're making this feature opt-in while we decide the migration strategy.

This change will also make it easier for docs.rs to build for targets that are not tier one, such as embedded targets.

How can I learn more?

You can learn more about the change in the issue proposing it and the PR with the implementation . Details on building non-tier-one targets are also available in the issue requesting the feature .

More information on targets and what it means to be a tier-one target is available in theplatform support page.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

明解C语言(第3版)

明解C语言(第3版)

[日] 柴田望洋 / 管杰、罗勇、杜晓静 / 人民邮电出版社 / 2015-11-1 / 79.00元

本书是日本的C语言经典教材,自出版以来不断重印、修订,被誉为“C语言圣经”。 本书图文并茂,示例丰富,第3版从190段代码和164幅图表增加至205段代码和220幅图表,对C语言的基础知识进行了彻底剖析,内容涉及数组、函数、指针、文件操作等。对于C语言语法以及一些难以理解的概念,均以精心绘制的示意图,清晰、通俗地进行讲解。原著在日本广受欢迎,始终位于网上书店C语言著作排行榜首位。一起来看看 《明解C语言(第3版)》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具