pub struct CodebaseMetadata {
pub infer_types_from_usage: bool,
pub aliases: HashMap<StringIdentifier, TypeMetadata>,
pub class_likes: HashMap<StringIdentifier, ClassLikeMetadata>,
pub function_likes: HashMap<(StringIdentifier, StringIdentifier), FunctionLikeMetadata>,
pub symbols: Symbols,
pub constants: HashMap<StringIdentifier, ConstantMetadata>,
pub all_class_like_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>,
pub direct_classlike_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>,
pub safe_symbols: HashSet<StringIdentifier>,
pub safe_symbol_members: HashSet<(StringIdentifier, StringIdentifier)>,
}Expand description
Holds all analyzed information about the symbols, structures, and relationships within a codebase.
This acts as the central repository for metadata gathered during static analysis, including details about classes, interfaces, traits, enums, functions, constants, their members, inheritance, dependencies, and associated types.
Fields§
§infer_types_from_usage: boolConfiguration flag: Should types be inferred based on usage patterns?
aliases: HashMap<StringIdentifier, TypeMetadata>Map from type alias name (StringIdentifier) to its metadata (TypeMetadata).
class_likes: HashMap<StringIdentifier, ClassLikeMetadata>Map from class-like FQCN (StringIdentifier) to its detailed metadata (ClassLikeMetadata).
function_likes: HashMap<(StringIdentifier, StringIdentifier), FunctionLikeMetadata>Map from a function/method identifier tuple (scope_id, function_id) to its metadata (FunctionLikeMetadata).
scope_id is the FQCN for methods or often StringIdentifier::empty() for global functions.
symbols: SymbolsStores the kind (Class, Interface, etc.) for every known symbol FQCN.
constants: HashMap<StringIdentifier, ConstantMetadata>Map from global constant FQN (StringIdentifier) to its metadata (ConstantMetadata).
all_class_like_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>Map from class/interface FQCN to the set of all its descendants (recursive).
direct_classlike_descendants: HashMap<StringIdentifier, HashSet<StringIdentifier>>Map from class/interface FQCN to the set of its direct descendants (children).
safe_symbols: HashSet<StringIdentifier>Set of symbols (FQCNs) considered “safe” or trusted (e.g., immutable, well-defined).
safe_symbol_members: HashSet<(StringIdentifier, StringIdentifier)>Set of specific members (SymbolFQCN, MemberName) considered “safe” or trusted.
Implementations§
Source§impl CodebaseMetadata
impl CodebaseMetadata
Sourcepub fn is_inheritable(&self, fq_class_name: &StringIdentifier) -> bool
pub fn is_inheritable(&self, fq_class_name: &StringIdentifier) -> bool
Checks if a class-like structure can be part of an intersection. Generally, only final classes cannot be intersected further down the hierarchy.
pub fn class_or_trait_can_use_trait( &self, child_class: &StringIdentifier, parent_trait: &StringIdentifier, ) -> bool
Sourcepub fn get_classconst_literal_value(
&self,
fq_class_name: &StringIdentifier,
const_name: &StringIdentifier,
) -> Option<&TAtomic>
pub fn get_classconst_literal_value( &self, fq_class_name: &StringIdentifier, const_name: &StringIdentifier, ) -> Option<&TAtomic>
Retrieves the literal value (as a TAtomic) of a class constant, if it was inferred.
Returns None if the class/constant doesn’t exist or the value type wasn’t inferred.
Sourcepub fn property_exists(
&self,
classlike_name: &StringIdentifier,
property_name: &StringIdentifier,
) -> bool
pub fn property_exists( &self, classlike_name: &StringIdentifier, property_name: &StringIdentifier, ) -> bool
Checks if a property with the given name exists (is declared or inherited) within the class-like structure.
Relies on ClassLikeMetadata::has_appearing_property.
Sourcepub fn method_exists(
&self,
classlike_name: &StringIdentifier,
method_name: &StringIdentifier,
) -> bool
pub fn method_exists( &self, classlike_name: &StringIdentifier, method_name: &StringIdentifier, ) -> bool
Checks if a method with the given name exists within the class-like structure.
Relies on ClassLikeMetadata::has_method.
Sourcepub fn appearing_method_exists(
&self,
classlike_name: &StringIdentifier,
method_name: &StringIdentifier,
) -> bool
pub fn appearing_method_exists( &self, classlike_name: &StringIdentifier, method_name: &StringIdentifier, ) -> bool
Checks if a method with the given name exists (is declared or inherited) within the class-like structure.
Relies on ClassLikeMetadata::has_appearing_method.
Sourcepub fn declaring_method_exists(
&self,
classlike_name: &StringIdentifier,
method_name: &StringIdentifier,
) -> bool
pub fn declaring_method_exists( &self, classlike_name: &StringIdentifier, method_name: &StringIdentifier, ) -> bool
Checks specifically if a method is declared directly within the given class-like (not just inherited).
Sourcepub fn get_declaring_class_for_property(
&self,
fq_class_name: &StringIdentifier,
property_name: &StringIdentifier,
) -> Option<&StringIdentifier>
pub fn get_declaring_class_for_property( &self, fq_class_name: &StringIdentifier, property_name: &StringIdentifier, ) -> Option<&StringIdentifier>
Finds the FQCN of the class/trait where a property was originally declared for a given class context.
Returns None if the property doesn’t appear in the class hierarchy.
Sourcepub fn get_property_metadata(
&self,
fq_class_name: &StringIdentifier,
property_name: &StringIdentifier,
) -> Option<&PropertyMetadata>
pub fn get_property_metadata( &self, fq_class_name: &StringIdentifier, property_name: &StringIdentifier, ) -> Option<&PropertyMetadata>
Retrieves the full metadata for a property as it appears in the context of a specific class.
This might be the metadata from the declaring class.
Returns None if the class or property doesn’t exist in this context.
Sourcepub fn get_property_type(
&self,
fq_class_name: &StringIdentifier,
property_name: &StringIdentifier,
) -> Option<&TUnion>
pub fn get_property_type( &self, fq_class_name: &StringIdentifier, property_name: &StringIdentifier, ) -> Option<&TUnion>
Retrieves the type union for a property within the context of a specific class.
It finds the declaring class of the property and returns its type signature.
Returns None if the property or its type cannot be found.
Sourcepub fn get_appearing_method_id(
&self,
method_id: &MethodIdentifier,
) -> MethodIdentifier
pub fn get_appearing_method_id( &self, method_id: &MethodIdentifier, ) -> MethodIdentifier
Resolves a MethodIdentifier to the identifier of the method as it appears in the given class context.
This could be the declaring class or an ancestor if inherited.
Sourcepub fn get_function_like(
&self,
identifier: &FunctionLikeIdentifier,
interner: &ThreadedInterner,
) -> Option<&FunctionLikeMetadata>
pub fn get_function_like( &self, identifier: &FunctionLikeIdentifier, interner: &ThreadedInterner, ) -> Option<&FunctionLikeMetadata>
Retrieves the metadata for a specific function-like construct using its identifier.
Sourcepub fn extend(&mut self, other: CodebaseMetadata)
pub fn extend(&mut self, other: CodebaseMetadata)
Merges information from another CodebaseMetadata into this one.
Collections are extended. For HashMaps, entries in other may overwrite existing ones.
pub fn take_issues(&mut self, user_defined: bool) -> IssueCollection
Trait Implementations§
Source§impl Clone for CodebaseMetadata
impl Clone for CodebaseMetadata
Source§fn clone(&self) -> CodebaseMetadata
fn clone(&self) -> CodebaseMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodebaseMetadata
impl Debug for CodebaseMetadata
Source§impl Default for CodebaseMetadata
Provides a default, empty CodebaseMetadata.
impl Default for CodebaseMetadata
Provides a default, empty CodebaseMetadata.
Source§impl<'de> Deserialize<'de> for CodebaseMetadata
impl<'de> Deserialize<'de> for CodebaseMetadata
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>,
Source§impl PartialEq for CodebaseMetadata
impl PartialEq for CodebaseMetadata
Source§impl Serialize for CodebaseMetadata
impl Serialize for CodebaseMetadata
impl StructuralPartialEq for CodebaseMetadata
Auto Trait Implementations§
impl Freeze for CodebaseMetadata
impl RefUnwindSafe for CodebaseMetadata
impl Send for CodebaseMetadata
impl Sync for CodebaseMetadata
impl Unpin for CodebaseMetadata
impl UnwindSafe for CodebaseMetadata
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> 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>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);