About Docs.rs

Docs.rs (formerly cratesfyi) is an open source documentation host for crates of the Rust Programming Language.

Docs.rs automatically builds crates' documentation released on crates.io using the nightly release of the Rust compiler. The current version of the Rust compiler in use is rustc 1.44.0-nightly (a5b09d354 2020-03-31). If you need a newer version of this compiler, check the issues page and file a new issue if you don't see an existing request.

The source code of Docs.rs is available on GitHub. If you ever encounter an issue, don't hesitate to report it! (And thanks in advance!)

The README of a crate is taken from the readme field defined in Cargo.toml. If a crate doesn't have this field, no README will be displayed.

Global sandbox limits

All the builds on docs.rs are executed inside a sandbox with limited resources. The current limits are the following:

Available RAM 3 GB
Maximum number of build targets 10
Maximum rustdoc execution time 15 minutes
Maximum size of a build log 100 KB
Network access blocked

If a build fails because it hit one of those limits please open an issue to get them increased for your crate.

Redirections

Docs.rs is using semver to parse URLs. You can use this feature to access crates' documentation easily. Example of URL redirections for clap crate:

URL Redirects to documentation of
docs.rs/clap Latest version of clap
docs.rs/clap/~2 2.* version
docs.rs/clap/~2.9 2.9.* version
docs.rs/clap/2.9.3 2.9.3 version (you don't need = unlike semver)
docs.rs/clap/*/clap/struct.App.html Latest version of this page (if it still exists). "latest" or "newest" work as well as *.

Badges

You can use badges to show state of your documentation to your users. The default badge will be pointed at the latest version of a crate. You can use version parameter to show status of documentation for any version you want.

Badge will display in blue if docs.rs is successfully hosting your crate documentation, and red if building documentation failing.

Example badges for mio crate:

URL Badge
Latest version: https://docs.rs/mio/badge.svg mio
Version 0.4.4: https://docs.rs/mio/badge.svg?version=0.4.4 mio
Version 0.1.0: https://docs.rs/mio/badge.svg?version=0.1.0 mio

Metadata for custom builds

You can customize docs.rs builds by defining [package.metadata.docs.rs] table in your crates' `Cargo.toml`.

The available configuration flags you can customize are:

[package]
name = "test"

[package.metadata.docs.rs]

# Features to pass to Cargo (default: none)
features = [ "feature1", "feature2" ]

# Whether to pass `--all-features` to Cargo (default: false)
all-features = true

# Whether to pass `--no-default-features` to Cargo (default: false)
no-default-features = true

# Target to test build on, used as the default landing page (default: "x86_64-unknown-linux-gnu")
#
# Any target supported by rustup can be used.
default-target = "x86_64-unknown-linux-gnu"

# Targets to build (default: see below)
#
# Any target supported by rustup can be used.
#
# Default targets:
# - x86_64-unknown-linux-gnu
# - x86_64-apple-darwin
# - x86_64-pc-windows-msvc
# - i686-unknown-linux-gnu
# - i686-pc-windows-msvc
#
# Set this to `[]` to only build the default target.
#
# If `default-target` is unset, the first element of `targets` is treated as the default target.
# Otherwise, these `targets` are built in addition to the default target.
# If both `default-target` and `targets` are unset,
#   all tier-one targets will be built and `x86_64-unknown-linux-gnu` will be used as the default target.
targets = [ "x86_64-apple-darwin", "x86_64-pc-windows-msvc" ]

# Additional `RUSTFLAGS` to set (default: none)
rustc-args = [ "--example-rustc-arg" ]

# Additional `RUSTDOCFLAGS` to set (default: none)
rustdoc-args = [ "--example-rustdoc-arg" ]

Test crate documentation build locally

The docs.rs README describes how to build an unpublished crate's documentation locally using the same build environment as the build agent.

Version

Currently running Docs.rs version is: 0.6.0 (c4848be 2020-03-31)

Contact

Docs.rs is run and maintained by the Docs.rs team. You can find us in #docs-rs on Discord.