pub struct Names {
pub fully_qualified: DeclUse<FullyQualifiedName>,
pub simple: DeclUse<SimpleName>,
pub external_simple: DeclUse<SimpleName>,
}Expand description
Collection of names/symbols which are found inside a file or segment of code. This includes both declarations and usages of symbols.
Fields§
§fully_qualified: DeclUse<FullyQualifiedName>Can be unambiguously placed in a specific source, such as a package the code depends on, with the source module and full access hierarchy.
simple: DeclUse<SimpleName>Any valid symbol names in the code, local ones as well as imported ones and such whose origin cannot be determined.
external_simple: DeclUse<SimpleName>The subset of simple names which do not originate in the current file and are not builtins or part of the prelude. For a compilation unit, this will include only imported names, for a code snippet, it will also include names which are implicitly declared outside of the snippet.
Implementations§
Source§impl Names
impl Names
Sourcepub fn within_extent(&self, extent: &Extent) -> Self
pub fn within_extent(&self, extent: &Extent) -> Self
Narrow down the names to a specific extent by filtering out all kinds of names which are not within the provided extent.
Sourcepub fn filter_matches(
&self,
names: &HashSet<&str>,
used_fqns: &HashSet<&str>,
) -> Self
pub fn filter_matches( &self, names: &HashSet<&str>, used_fqns: &HashSet<&str>, ) -> Self
Narrow down the names to a subset whose string representations match the provided names (simple names), and used_fqns (FQNs).
Sourcepub fn find_line_range_with_max_used_names(&self, lines: usize) -> Option<Range>
pub fn find_line_range_with_max_used_names(&self, lines: usize) -> Option<Range>
Find a contiguous block spanning across number of lines with maximum occurrence of used simple names and used FQNs. Returns start and end line numbers for the block indexed with 0 as the first line.
pub fn non_overlapping_extents(&self) -> Vec<Extent>
Trait Implementations§
impl Eq for Names
impl StructuralPartialEq for Names
Auto Trait Implementations§
impl Freeze for Names
impl RefUnwindSafe for Names
impl Send for Names
impl Sync for Names
impl Unpin for Names
impl UnwindSafe for Names
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
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>
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>
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