# Function rustdoc::html::render::write_shared::write_shared

source ·

    pub(super) fn write_shared(
        cx: &mut Context<'_>,
        krate: &Crate,
        search_index: String,
        options: &RenderOptions
    ) -> Result<(), Error>

Expand description

Rustdoc writes out 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: immutable` directive. 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 “invocation-specific”.