Sometimes, there might be multiple items with the same name, for example
std::u8 is both a module and a primitive. Previously, we could not
determine which one Source::load_doc would return. With this patch, we
add the ty parameter that can be used to filter by the item type.
Previously, we only used the name and the description to represent index
items. Therefore we consider e. g. the std::u8 module and the std::u8
primitive to be the same. With this patch, we also take the item type
into account when comparing index items.
Previosuly, we used the u8 values for the ItemType variants used in the
search index as the discriminant. But as the ID used in the search
index is an implementation detail of the index parser, this patch moves
the mapping to the index module.
This patch adds some basic info log messages to make it easier to debug
incompatible rustdoc output. To show the messages, run rusty-man with
the environment variable RUST_LOG=info.
Previously, our ItemType enum only had three values: Module, Item and
Member. With this patch we import the ItemType variants from librustdoc
(see html/item_type.rs) for better compatibility and easier parsing.
Previosuly, we used strings to store item names. Sometimes, these
strings would refer to full paths (e. g. kuchiki::NodeDataRef::as_node),
sometimes to local paths (e. g. NodeDataRef::as_node) and sometimes only
to the last item (e. g. as_node).
With this patch, we add two new types: doc::Name is a name without a
semantic meaning, so it could be any of the cases mentioned above.
doc::Fqn is a wrapper around doc::Name that stores fully-qualifier
names, i. e. names where the first element is the crate.
This patch adds support for listing the module members on its
documentation page. This is quite easy as the items are displayed in a
single table per item type.
When searching for a keyword, we typically don’t want to match an
associated type. With this patch, we skip associated types when
searching items in the search index.
For members, the path listed in the search index does not point to the
parent item but to the path of the parent item. To get the parent item,
we have to access the parent field and lookup the index in the crate’s
path list.
rustdoc clears the path of an item in the search index if it is equal to
the path of the previous item (see build_index in html/render.rs).
Previously, we used the crate name if the path was empty. With this
patch, we use the past of the last item instead.
Previously, we only compared the type names when searching for matches
in the search index. With this patch, we also check the path: If the
full name of the item ends with the keyword (prepended with :: to avoid
partial matches), we return a match.