pub struct TypeRenderer<'a> {
link_resolver: &'a LinkResolver<'a>,
current_module: &'a str,
}Expand description
Renderer for type expressions
Fields§
§link_resolver: &'a LinkResolver<'a>§current_module: &'a strImplementations§
Source§impl<'a> TypeRenderer<'a>
impl<'a> TypeRenderer<'a>
pub fn new(link_resolver: &'a LinkResolver<'a>, current_module: &'a str) -> Self
Sourcepub fn render_type(&self, type_info: &TypeInfo) -> DocTypeExpr
pub fn render_type(&self, type_info: &TypeInfo) -> DocTypeExpr
Render a type expression
- Check if this is a type alias - preserve name, don’t expand
- Strip module prefixes from display text
- Resolve link target using LinkResolver
- Recursively handle generic parameters
Sourcefn render_type_structure(
&self,
structure: &TypeStructure,
type_info: &TypeInfo,
) -> DocTypeExpr
fn render_type_structure( &self, structure: &TypeStructure, type_info: &TypeInfo, ) -> DocTypeExpr
Recursively render a TypeStructure into a DocTypeExpr
Sourcefn try_create_link_for_name(
&self,
name: &str,
type_info: &TypeInfo,
) -> Option<LinkTarget>
fn try_create_link_for_name( &self, name: &str, type_info: &TypeInfo, ) -> Option<LinkTarget>
Try to create a link target for a simple type name Uses type_refs to look up module information
Sourcefn strip_module_prefix(&self, type_name: &str) -> String
fn strip_module_prefix(&self, type_name: &str) -> String
Strip module prefixes from type names Remove “typing.”, “builtins.”, “package.submod.” Keep only bare names: “Optional[ClassA]” not “typing.Optional[sub_mod.ClassA]”
Auto Trait Implementations§
impl<'a> Freeze for TypeRenderer<'a>
impl<'a> RefUnwindSafe for TypeRenderer<'a>
impl<'a> Send for TypeRenderer<'a>
impl<'a> Sync for TypeRenderer<'a>
impl<'a> Unpin for TypeRenderer<'a>
impl<'a> UnwindSafe for TypeRenderer<'a>
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> 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