mod use_directive
- module use_directive
Enums
- enum UseDirectiveOption
Options for the use directive.
- UsedName(String)
- Reexport(String)
Traits implemented
- impl RstOption for UseDirectiveOption
Functions
- fn get_rst_text(&self, indent: &str) -> Option<String>
- impl MdOption for UseDirectiveOption
Functions
- fn get_md_text(&self) -> Option<String>
Structs and Unions
- struct UseDirective
- paths: BTreeMap<String, String>
- reexport: Option<String>
- content: Vec<String>
- directive_visibility: DirectiveVisibility
Implementations
- impl UseDirective
Variables
- const DIRECTIVE_NAME: &'static str
Functions
- fn contains(&self, item_path: &str) -> bool
Check whether the directive contains the given path.
This returns true if the
item_pathis one of the paths in the directive.
- fn directive_visibility(&self) -> &DirectiveVisibility
Return the visibility of this directive.
- fn find(&self, ident: &str) -> Option<&String>
Find the path for the given ident within the use directive, if any.
- fn for_path(path: &str, target: &str) -> Self
Create a use directive for a path with the provided target.
- fn for_use_paths(paths: BTreeMap<String, String>) -> Self
Create a use directive using the provided used name to path map.
- fn from_item(parent_path: &str, item: &ItemUse) -> Self
Create a use directive from the AST item parsed by syn.
- fn from_item_as_directive(parent_path: &str, item: &ItemUse) -> Directive
Create a use directive and wrap it within the
Directive::UseDirectiveenum variant.
- fn inline(&mut self, item_name: &str) -> Option<(String, String)>
Inlines an item and returns it as a new
(used_name, path)tuple.The new path is
{reexport}::{used_name}of the old path. The used name for the new path is the same as that of the old path.- Returns:
The function returns None if the directive is not a re-export or a path matching the item was not found.
- fn resolve_relative_paths(&mut self, modules: &Vec<ModuleDirective>)
Resolve any relative paths using the list of modules provided.
The method checks if any of the use paths are relative paths by comparing the first segment with the module’s ident. If it matches, the path is updated to be an absolute path starting with the crate.
Traits implemented
- impl RstDirective for UseDirective
Functions
- fn get_rst_text(self, level: usize, _: &DirectiveVisibility) -> Vec<String>
- impl MdDirective for UseDirective
Functions
- fn get_md_text(self, fence_size: usize, _: &DirectiveVisibility) -> Vec<String>