## RustdocFingerprint

# Struct RustdocFingerprint

Source

    pub struct RustdocFingerprint {
        path: PathBuf,
        rustc_vv: String,
        doc_parts: Vec<PathBuf>,
        on_disk: Option<RustdocFingerprintJson>,
    }

Expand description

Structure used to deal with Rustdoc fingerprinting

This is important because the `.js`/`.html` & `.css` files that are generated by Rustc don’t have any versioning yet (see https://github.com/rust-lang/cargo/issues/8461). Therefore, we can end up with weird bugs and behaviours if we mix different versions of these files.

We need to make sure that if there were any previous docs already compiled, they were compiled with the same Rustc version that we’re currently using. Otherwise we must remove the `doc/` folder and compile again forcing a rebuild.

## Fields§

§`path: PathBuf`

Path to the fingerprint file.

§`rustc_vv: String`

`rustc -vV` verbose version output for the current session.

§`doc_parts: Vec<PathBuf>`

Absolute paths to new cross crate info JSON files generated in the current session.

§`on_disk: Option<RustdocFingerprintJson>`

The fingerprint file on disk.

## Implementations§

Source§

### impl RustdocFingerprint

Source

#### pub fn check_rustdoc_fingerprint( build_runner: &BuildRunner<'_, '_>, ) -> CargoResult<()>

Checks whether the latest version of rustc used to compile this workspace’s docs was the same as the one is currently being used in this `cargo doc` call.

In case it’s not, it takes care of removing the `<build-dir>/doc/` folder as well as overwriting the rustdoc fingerprint info. This is to guarantee that we won’t end up with mixed versions of the `js/html/css` files which `rustdoc` autogenerates without any versioning.

Each requested target platform maintains its own fingerprint file. That is, if you run `cargo doc` and then `cargo doc --target wasm32-wasip1`, you will have two separate fingerprint files:

- `<build-dir>/.rustdoc_fingerprint.json` for host
- `<build-dir>/wasm32-wasip1/.rustdoc_fingerprint.json`

Source

#### pub fn new( build_runner: &BuildRunner<'_, '_>, kind: CompileKind, doc_parts: Vec<PathBuf>, ) -> Self

Creates a new fingerprint with given doc parts paths.

Source

#### pub fn persist<F>(&self, exec: F) -> CargoResult<()>
where F: Fn(&[&Path]) -> CargoResult<()>,

Persists the fingerprint.

The closure will run before persisting the fingerprint, and will be given a list of doc parts directories for passing to `rustdoc --include-parts-dir`.

Source

#### pub fn is_dirty(&self) -> bool

Checks if the fingerprint is outdated comparing against given doc parts file paths.

## Trait Implementations§

Source§

### impl Debug for RustdocFingerprint

Source§

#### fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

## Auto Trait Implementations§

§

### impl Freeze for RustdocFingerprint

§

### impl RefUnwindSafe for RustdocFingerprint

§

### impl Send for RustdocFingerprint

§

### impl Sync for RustdocFingerprint

§

### impl Unpin for RustdocFingerprint

§

### impl UnwindSafe for RustdocFingerprint

## Blanket Implementations§

Source§

### impl<T> Any for T
where T: 'static + ?Sized,

Source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
Source§

### impl<T> Borrow<T> for T
where T: ?Sized,

Source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

### impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

### impl<T> From<T> for T

Source§

#### fn from(t: T) -> T

Returns the argument unchanged.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
Source§

### impl<T, U> Into<U> for T
where U: From<T>,

Source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

Source§

### impl<T> IntoEither for T

Source§

#### fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left` is `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
Source§

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left(&self)` returns `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
§

### impl<T> Pointable for T

§

#### const ALIGN: usize

The alignment of pointer.
§

#### type Init = T

The type for initializers.
§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

### impl<T> Same for T

Source§

#### type Output = T

Should always be `Self`
Source§

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

#### type Error = Infallible

The type returned in the event of a conversion error.
Source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more

## Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain `repr(...)` attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 120 bytes