Expand description
Rustdoc writes aut two kinds of shared files:
- Static files, which are embedded in the rustdoc binary and are written with a
filename that includes a hash of their contents. These will always have a new
URL if the contents change, so they are safe to cache with the
Cache-Control: immutabledirective. They are written under the static.files/ directory and are written when –emit-type is empty (default) or contains “toolchain-specific”. If using the –static-root-path flag, it should point to a URL path prefix where each of these filenames can be fetched. - Invocation specific files. These are generated based on the crate(s) being
documented. Their filenames need to be predictable without knowing their
contents, so they do not include a hash in their filename and are not safe to
cache with
Cache-Control: immutable. They include the contents of the –resource-suffix flag and are emitted when –emit-type is empty (default) or contains “html-non-static-files”.
Re-exports§
use std::borrow::Cow;🔒use std::cell::RefCell;🔒use std::ffi::OsStr;🔒use std::ffi::OsString;🔒use std::fs::File;🔒use std::io;🔒use std::io::Write as _;🔒use std::iter::once;🔒use std::marker::PhantomData;🔒use std::path::Component;🔒use std::path::Path;🔒use std::path::PathBuf;🔒use std::rc::Rc;🔒use std::rc::Weak;🔒use std::str::FromStr;🔒use std::fmt;🔒use std::fs;🔒use indexmap::IndexMap;🔒use rustc_ast::join_path_syms;🔒use rustc_data_structures::fx::FxHashSet;🔒use rustc_data_structures::fx::FxIndexMap;🔒use rustc_data_structures::fx::FxIndexSet;🔒use rustc_middle::ty::TyCtxt;🔒use rustc_session::Session;🔒use rustc_span::Symbol;🔒use rustc_span::def_id::DefId;🔒use serde::de::DeserializeOwned;🔒use serde::ser::SerializeSeq;🔒use serde::Deserialize;🔒use serde::Deserialize;🔒use serde::Serialize;🔒use serde::Serialize;🔒use serde::Serializer;🔒use super::Context;🔒use super::RenderMode;🔒use super::collect_paths_for_type;🔒use super::ensure_trailing_slash;🔒use crate::clean::types::impl_may_apply_to_type_alias;🔒use crate::clean::Crate;🔒use crate::clean::Item;🔒use crate::clean::ItemId;🔒use crate::clean::ItemKind;🔒use crate::config::EmitType;🔒use crate::config::PathToParts;🔒use crate::config::RenderOptions;🔒use crate::config::ShouldMerge;🔒use crate::docfs::PathError;🔒use crate::error::Error;🔒use crate::formats::Impl;🔒use crate::formats::item_type::ItemType;🔒use crate::html::format::print_impl;🔒use crate::html::format::print_path;🔒use crate::html::layout;🔒use crate::html::render::ordered_json::EscapedJson;🔒use crate::html::render::ordered_json::OrderedJson;🔒use crate::html::render::print_item::compare_names;🔒use crate::html::render::search_index::SerializedSearchIndex;🔒use crate::html::render::search_index::build_index;🔒use crate::html::render::sorted_template;🔒use crate::html::render::sorted_template::FileFormat;🔒use crate::html::render::sorted_template::SortedTemplate;🔒use crate::html::render::AssocItemLink;🔒use crate::html::render::ImplRenderingParameters;🔒use crate::html::render::StylePath;🔒use crate::html::render::scrape_examples_help;🔒use crate::html::static_files;🔒use crate::html::static_files::suffix_path;🔒use crate::visit::DocVisitor;🔒use crate::DOC_RUST_LANG_ORG_VERSION;🔒use crate::try_err;🔒use crate::try_none;🔒
Modules§
- flock 🔒
Structs§
- Alias
Serializable 🔒Impl - Final serialized form of the alias impl
- Aliased
Type 🔒 - Data for an aliased type.
- Aliased
Type 🔒Impl - The
impl_contains data that’s used to figure out if an alias will work, and to generate the HTML at the end. - AllCrates 🔒
- AllCrates
Entry 🔒 - Type of a serialized entry in the
AllCratesPartJSON. - Crate
Info 🔒 - Contains pre-rendered contents to insert into the CCI template
- Crates
Index 🔒 - Hierarchy 🔒
- Source files directory tree
- Implementor 🔒
- Part 🔒
- A piece of one of the shared artifacts for documentation (search index, sources, alias list, etc.)
- Parts
AndLocations 🔒 - Paths (relative to the doc root) and their pre-merge contents
- Sources 🔒
- Trait
Alias 🔒 - Type
Alias 🔒 - Type
Impl 🔒Collector - Collect the list of aliased types and their aliases. https://github.com/search?q=repo%3Arust-lang%2Frust+[RUSTDOCIMPL]+type.impl&type=code
Enums§
- Crate
Info 🔒Version - Version for the format of the crate-info file.
Traits§
- CciPart 🔒
- Wrapper trait for
Part<T, U>
Functions§
- create_
parents 🔒 - Create all parents
- get_
path_ 🔒parts - hack_
get_ 🔒external_ crate_ names - Reads
crates.js, which seems like the best place to obtain the list of externally documented crates if the index page was disabled when documenting the deps. - read_
template_ 🔒or_ blank - Returns a blank template unless we could find one to append to
- write_
not_ 🔒crate_ specific - Writes files that are written directly to the
--out-dir, without the prefix from the current crate. These are the rendered cross-crate files that encode info from multiple crates (e.g. search index), and the static files. - write_
rendered_ 🔒cci - info from this crate and the –include-info-json’d crates
- write_
rendered_ 🔒cross_ crate_ info - write_
resources 🔒 - Writes the static files, the style files, and the css extensions. Have to be careful about these, because they write to the root out dir.
- write_
shared 🔒