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: PathBufPath to the fingerprint file.
rustc_vv: Stringrustc -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
impl RustdocFingerprint
Sourcepub fn check_rustdoc_fingerprint(
build_runner: &BuildRunner<'_, '_>,
) -> CargoResult<()>
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.jsonfor host<build-dir>/wasm32-wasip1/.rustdoc_fingerprint.json
Sourcepub fn new(
build_runner: &BuildRunner<'_, '_>,
kind: CompileKind,
doc_parts: Vec<PathBuf>,
) -> Self
pub fn new( build_runner: &BuildRunner<'_, '_>, kind: CompileKind, doc_parts: Vec<PathBuf>, ) -> Self
Creates a new fingerprint with given doc parts paths.
Sourcepub fn persist<F>(&self, exec: F) -> CargoResult<()>
pub fn persist<F>(&self, exec: F) -> 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.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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