Skip to main content

Walk

Struct Walk 

struct Walk<'a> {
    sources: &'a Sources,
    files: BTreeMap<&'a str, &'a SourceFile>,
    collected: BTreeMap<String, BTreeSet<(Kind, String)>>,
    unresolved: Vec<String>,
    queue: Vec<Pending>,
    walked: BTreeSet<String>,
}
Expand description

The Rust walk’s running state.

Fields§

§sources: &'a Sources

Every indexed declaration and re-export, plus the public-scope set.

§files: BTreeMap<&'a str, &'a SourceFile>

Every parsed file, by repository-relative path, for walking a module body.

§collected: BTreeMap<String, BTreeSet<(Kind, String)>>

A symbol can be two items at once — atune::Space is the Space trait and the Space derive macro, and rustdoc writes both trait.Space.html and derive.Space.html. Collected as a multimap so the collision is visible, then split into disambiguated keys.

§unresolved: Vec<String>

Every unresolved name, not the first: a developer who has just moved a module wants the whole list, and a generator that stops at the first makes the second look like a new regression (the rule generate_all::run already follows across generators).

§queue: Vec<Pending>

Modules found but not yet walked.

§walked: BTreeSet<String>

Module keys already walked, so a module reachable by two paths — or a cyclic pub use — is walked once instead of forever.

Implementations§

§

impl Walk<'_>

fn module(&mut self, reference: &str, key: &str, doc_dir: &str, items: &[Item])

Maps every public item a module body declares or re-exports.

reference is the file the body is written in — which is what a relative pub use path is resolved against. key and doc_dir are the module’s symbol prefix and documented directory.

fn declaration( &mut self, reference: &str, key: &str, doc_dir: &str, name: &str, kind: Kind, )

Files one declaration under the key and page that actually name it.

Almost always the enclosing module’s — except for a macro, which Rust exports from the crate root however deeply it is written: #[macro_export] macro_rules! storage_conformance_tests sits in atune_core::storage::conformance and its only valid path is atune_core::storage_conformance_tests, with its page at atune_core/macro.storage_conformance_tests.html. The same holds for a proc macro, whose crate exports every macro at its root. Found by check-api-links, which is exactly the class of mistake it exists to catch (§1.3.113) — and it is the other half of §1.3.85, where the facade’s conformance feature doc promises atune::storage_conformance_tests! and that path does not resolve either.

fn submodule( &mut self, reference: &str, key: &str, doc_dir: &str, module: &ItemMod, )

Records a pub mod, then walks it — inline bodies here, files via the queue.

fn leaf(&mut self, reference: &str, key: &str, doc_dir: &str, leaf: &Leaf)

Resolves one re-exported leaf and files it, or records why it could not be.

fn enqueue(&mut self, key: String, doc_dir: String, scope: String)

Queues a module for walking, once.

fn pending(&mut self, pending: &Pending)

Walks a queued module’s own source file.

A module is either <scope>.rs or <scope>/mod.rs, and both spellings are in this workspace. A scope with neither is not an error: an inline module’s members were walked at its declaration, and a re-exported module from outside the three indexed crates has no file here to read.

fn resolve( &self, reference: &str, here: &str, leaf: &Leaf, ) -> Result<(String, Kind, String), String>

Where a re-exported leaf’s rustdoc page lives, what kind of item it is, and which name rustdoc gave the page.

§Errors

The sentence to report when the leaf’s declaration cannot be followed, or when two declarations of the name under one scope disagree about its kind. A kind decides the file name, so a guess would be a dead link. Returned as a detail rather than as an Error so the caller can collect every one.

Auto Trait Implementations§

§

impl<'a> !Send for Walk<'a>

§

impl<'a> !Sync for Walk<'a>

§

impl<'a> Freeze for Walk<'a>

§

impl<'a> RefUnwindSafe for Walk<'a>

§

impl<'a> Unpin for Walk<'a>

§

impl<'a> UnsafeUnpin for Walk<'a>

§

impl<'a> UnwindSafe for Walk<'a>

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
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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