pub struct CrateDoc { /* private fields */ }
Expand description
This should be the main data structure to refer to documentation and the items tree structure in public modules.
It’s cheap to clone and use a ID buffer to avoid the cost of generating a new string in query.
Implementations§
Methods from Deref<Target = IDMap>§
pub fn dmodule(&self) -> &DModule
pub fn raw_crate_doc(&self) -> &Crate
Sourcepub fn use_id<T>(&self, id: &str, f: impl FnOnce(&Id) -> T) -> T
pub fn use_id<T>(&self, id: &str, f: impl FnOnce(&Id) -> T) -> T
Use in a buffered way in hot querys.
pub fn indexmap(&self) -> &IndexMap
pub fn pathmap(&self) -> &PathMap
Sourcepub fn dmodule_show_prettier(&self) -> DocTree
pub fn dmodule_show_prettier(&self) -> DocTree
FIXME: show_prettier should be renamed
Sourcepub fn dmodule_item_tree(&self) -> DocTree
pub fn dmodule_item_tree(&self) -> DocTree
This is the default tree view for most cases.
pub fn get_doc(&self, id: &str) -> Option<&str>
pub fn get_item(&self, id: &str) -> Option<&Item>
Sourcepub fn name<S>(&self, id: &S) -> XString
pub fn name<S>(&self, id: &S) -> XString
- If the id refers to an Item with a name, use the name;
- if name is None, try getting the name depending on item type (reexported local items may hit this);
- If id isn’t in IndexMap, try searching the PathMap for last path component (reexported external items may hit this);
- otherwise id.
pub fn get_path(&self, id: &str) -> Option<&ItemSummary>
Sourcepub fn path_with_kind_check<S, K>(&self, id: &S, kind: K) -> XString
pub fn path_with_kind_check<S, K>(&self, id: &S, kind: K) -> XString
Like path
, but with strict item kind checking.
If the id doesn’t refer to an ItemSummary with exact given kind, emit a warn.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CrateDoc
impl<'de> Deserialize<'de> for CrateDoc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CrateDoc
impl !RefUnwindSafe for CrateDoc
impl !Send for CrateDoc
impl !Sync for CrateDoc
impl Unpin for CrateDoc
impl !UnwindSafe for CrateDoc
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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