Names

Struct Names 

Source
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

Source

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.

Source

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).

Source

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.

Source

pub fn non_overlapping_extents(&self) -> Vec<Extent>

Trait Implementations§

Source§

impl Debug for Names

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Names

Source§

fn eq(&self, other: &Names) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Names

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.