pub struct ModuleGraph { /* private fields */ }Expand description
In-memory module dependency graph.
This implementation uses HashMaps for fast lookups and is fully synchronous.
Implementations§
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn dependency_chains_to(
&self,
target: &ModuleId,
) -> Result<Vec<DependencyChain>>
pub fn dependency_chains_to( &self, target: &ModuleId, ) -> Result<Vec<DependencyChain>>
Find all dependency chains from entry points to a target module.
This traces all possible paths through the import graph, useful for understanding why a module is included in the bundle and what depends on it.
Sourcepub fn analyze_dependency_chains(
&self,
target: &ModuleId,
) -> Result<ChainAnalysis>
pub fn analyze_dependency_chains( &self, target: &ModuleId, ) -> Result<ChainAnalysis>
Analyze dependency chains to a module.
Provides comprehensive statistics about all paths leading to a module.
Sourcepub fn import_depth(&self, module: &ModuleId) -> Result<Option<usize>>
pub fn import_depth(&self, module: &ModuleId) -> Result<Option<usize>>
Get the import depth of a module from entry points.
Returns the shortest distance from any entry point to this module, or None if the module is unreachable.
Sourcepub fn modules_by_depth(&self) -> Result<HashMap<usize, Vec<ModuleId>>>
pub fn modules_by_depth(&self) -> Result<HashMap<usize, Vec<ModuleId>>>
Group modules by their import depth from entry points.
This creates layers of the dependency graph, useful for visualizing the structure and understanding module organization.
Sourcepub fn is_reachable_only_through_dead_code(
&self,
module: &ModuleId,
) -> Result<bool>
pub fn is_reachable_only_through_dead_code( &self, module: &ModuleId, ) -> Result<bool>
Check if a module is only reachable through dead code.
A module is considered “reachable only through dead code” if:
- It has no direct path from any entry point, OR
- All paths to it go through unreachable modules
This is a strong indicator that the module can be safely removed.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn from_modules<I>(modules: I) -> Result<Self>where
I: IntoIterator<Item = Module>,
pub fn from_modules<I>(modules: I) -> Result<Self>where
I: IntoIterator<Item = Module>,
Construct a graph from an iterator of modules (without edges).
Sourcepub fn from_collected_data(collection: CollectionState) -> Result<Self>
pub fn from_collected_data(collection: CollectionState) -> Result<Self>
Create a ModuleGraph from collected module data.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn unused_exports(&self) -> Result<Vec<UnusedExport>>
pub fn unused_exports(&self) -> Result<Vec<UnusedExport>>
Discover unused exports, respecting framework markers and namespace imports.
Sourcepub fn compute_export_usage_counts(&self) -> Result<()>
pub fn compute_export_usage_counts(&self) -> Result<()>
Computes and sets usage counts for all exports in the module graph.
For each export in each module, this counts how many times it’s imported
across all dependent modules and updates the usage_count field.
Usage counts are determined by:
- Named imports: Each
import { foo }increments the count for export “foo” - Default imports: Each
import fooincrements the count for export “default” - Namespace imports: Each
import * as nsincrements the count for ALL exports by 1 (except star re-exports which only forward, not consume) - Re-exports: Counted separately as they create new import paths
After calling this method, each Export will have usage_count set to:
Some(0)if the export is unusedSome(n)where n > 0 for the number of import sites
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub async fn apply_framework_rule(
&self,
rule: Box<dyn FrameworkRule>,
) -> Result<()>
pub async fn apply_framework_rule( &self, rule: Box<dyn FrameworkRule>, ) -> Result<()>
Apply a custom framework rule.
Framework rules mark exports as framework-used based on naming conventions. This prevents false-positive “unused export” warnings.
Note: FrameworkRule::apply is async, so we use tokio::runtime::Handle::current() to execute it. This maintains compatibility with the async trait while Apply a single framework rule asynchronously.
§Platform Availability
This method is only available on native platforms (not WASM) because it requires tokio runtime support.
Sourcepub async fn apply_framework_rules(
&self,
rules: Vec<Box<dyn FrameworkRule>>,
) -> Result<()>
pub async fn apply_framework_rules( &self, rules: Vec<Box<dyn FrameworkRule>>, ) -> Result<()>
Apply multiple framework rules asynchronously.
§Platform Availability
This method is only available on native platforms (not WASM) because it requires tokio runtime support.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn side_effect_only_imports(&self) -> Result<Vec<SideEffectImport>>
pub fn side_effect_only_imports(&self) -> Result<Vec<SideEffectImport>>
Get all side-effect-only imports across the graph.
Side-effect imports like import 'polyfill' execute code but don’t bind any values.
These are important to track as they can’t be tree-shaken and always contribute
to bundle size.
Sourcepub fn namespace_imports(&self) -> Result<Vec<NamespaceImportInfo>>
pub fn namespace_imports(&self) -> Result<Vec<NamespaceImportInfo>>
Get all namespace imports and their usage.
Namespace imports (import * as foo) import all exports from a module.
This is useful for tracking potential over-imports that could be optimized
to named imports.
Sourcepub fn type_only_imports(&self) -> Result<Vec<TypeOnlyImport>>
pub fn type_only_imports(&self) -> Result<Vec<TypeOnlyImport>>
Get all type-only imports (TypeScript).
Type-only imports are erased at runtime and don’t contribute to bundle size. Tracking these helps understand the TypeScript structure without conflating with runtime dependencies.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn add_module(&self, module: Module) -> Result<()>
pub fn add_module(&self, module: Module) -> Result<()>
Add a module into the graph.
Sourcepub fn add_dependency(&self, from: ModuleId, to: ModuleId) -> Result<()>
pub fn add_dependency(&self, from: ModuleId, to: ModuleId) -> Result<()>
Add a dependency edge, creating forward and reverse mappings.
Sourcepub fn add_dependencies<I>(&self, from: ModuleId, targets: I) -> Result<()>where
I: IntoIterator<Item = ModuleId>,
pub fn add_dependencies<I>(&self, from: ModuleId, targets: I) -> Result<()>where
I: IntoIterator<Item = ModuleId>,
Add multiple dependencies from a single module.
Sourcepub fn add_entry_point(&self, id: ModuleId) -> Result<()>
pub fn add_entry_point(&self, id: ModuleId) -> Result<()>
Mark a module as an entry point.
Sourcepub fn add_external_dependency(&self, dep: ExternalDependency) -> Result<()>
pub fn add_external_dependency(&self, dep: ExternalDependency) -> Result<()>
Add an external dependency record.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn unused_npm_dependencies(
&self,
package_json: &PackageJson,
include_dev: bool,
include_peer: bool,
) -> Result<Vec<UnusedDependency>>
pub fn unused_npm_dependencies( &self, package_json: &PackageJson, include_dev: bool, include_peer: bool, ) -> Result<Vec<UnusedDependency>>
Detect unused npm dependencies by cross-referencing package.json with imports.
This identifies dependencies declared in package.json but never actually imported in the codebase. Useful for cleaning up unused packages.
§Parameters
package_json: Parsed package.json fileinclude_dev: Whether to check devDependenciesinclude_peer: Whether to check peerDependencies
Sourcepub fn dependency_coverage(
&self,
package_json: &PackageJson,
) -> Result<DependencyCoverage>
pub fn dependency_coverage( &self, package_json: &PackageJson, ) -> Result<DependencyCoverage>
Get dependency coverage statistics.
Provides detailed metrics about which dependencies are actually used vs declared in package.json.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn module(&self, id: &ModuleId) -> Result<Option<Module>>
pub fn module(&self, id: &ModuleId) -> Result<Option<Module>>
Retrieve a module by ID.
Returns an owned Module. Internally uses Arc for efficient storage,
so this clone is inexpensive (only shared data like Vec
§Example
let module = graph.module(module_id)?.unwrap();
println!("Path: {}", module.path.display());Sourcepub fn module_by_path(&self, path: &Path) -> Result<Option<Module>>
pub fn module_by_path(&self, path: &Path) -> Result<Option<Module>>
Get module by filesystem path.
Returns an owned Module. Internally uses Arc for efficient storage,
so this clone is inexpensive.
Sourcepub fn modules(&self) -> Result<Vec<Module>>
pub fn modules(&self) -> Result<Vec<Module>>
Get all modules.
Returns owned Module instances. Internally uses Arc for efficient storage,
so these clones are inexpensive.
Sourcepub fn dependencies(&self, id: &ModuleId) -> Result<Vec<ModuleId>>
pub fn dependencies(&self, id: &ModuleId) -> Result<Vec<ModuleId>>
Dependencies of a module (forward edges).
Sourcepub fn dependents(&self, id: &ModuleId) -> Result<Vec<ModuleId>>
pub fn dependents(&self, id: &ModuleId) -> Result<Vec<ModuleId>>
Dependents of a module (reverse edges).
Sourcepub fn entry_points(&self) -> Result<Vec<ModuleId>>
pub fn entry_points(&self) -> Result<Vec<ModuleId>>
Entry points set.
Sourcepub fn imports_for_module(&self, id: &ModuleId) -> Result<Option<Vec<Import>>>
pub fn imports_for_module(&self, id: &ModuleId) -> Result<Option<Vec<Import>>>
Get imports for a module.
Sourcepub fn external_dependencies(&self) -> Result<Vec<ExternalDependency>>
pub fn external_dependencies(&self) -> Result<Vec<ExternalDependency>>
Aggregate external dependencies based on import data.
Sourcepub fn unreachable_modules(&self) -> Result<Vec<Module>>
pub fn unreachable_modules(&self) -> Result<Vec<Module>>
Compute modules with no dependents and no side effects.
Returns owned Module instances. Internally uses Arc for efficient storage,
so these clones are inexpensive.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn to_dot_format(&self) -> Result<String>
pub fn to_dot_format(&self) -> Result<String>
Export the graph as DOT format for visualization.
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>>
pub fn to_bytes(&self) -> Result<Vec<u8>>
Serialize the graph to binary format using bincode.
This includes a format version for forward compatibility and the full graph state (modules, dependencies, dependents, entry points, external deps).
§Format Version
The binary format starts with a u32 version number:
- Version 1: Initial implementation with GraphInner serialization
§Errors
Returns an error if serialization fails or if the graph is poisoned.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Deserialize the graph from binary format.
§Errors
Returns an error if:
- Deserialization fails
- The format version is incompatible with the current implementation
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn statistics(&self) -> Result<GraphStatistics>
pub fn statistics(&self) -> Result<GraphStatistics>
Compute statistics snapshot for dashboards.
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn unused_symbols(&self) -> Result<Vec<UnusedSymbol>>
pub fn unused_symbols(&self) -> Result<Vec<UnusedSymbol>>
Get all unused symbols across the entire graph.
This queries the symbol table for each module and returns symbols that are declared but never referenced.
Sourcepub fn unused_symbols_in_module(&self, id: &ModuleId) -> Result<Vec<Symbol>>
pub fn unused_symbols_in_module(&self, id: &ModuleId) -> Result<Vec<Symbol>>
Get unused symbols for a specific module.
Returns an empty vector if the module doesn’t exist.
Sourcepub fn all_symbols(&self) -> Result<Vec<UnusedSymbol>>
pub fn all_symbols(&self) -> Result<Vec<UnusedSymbol>>
Get all symbols across the entire graph (not just unused ones).
This is useful for code quality analysis that needs to check all symbols, regardless of whether they’re used or not.
Sourcepub fn unreachable_code(&self) -> Result<Vec<UnreachableCode>>
pub fn unreachable_code(&self) -> Result<Vec<UnreachableCode>>
Get unreachable code detected across the graph.
Note: Unreachable code detection must be performed during module analysis
(when source code is available) rather than from the graph.
Use crate::graph::semantic::detect_unreachable_code() during module building.
This method currently returns an empty vector as a placeholder for graph-level aggregation if unreachable code data is stored in modules in the future.
Sourcepub fn symbol_statistics(&self) -> Result<SymbolStatistics>
pub fn symbol_statistics(&self) -> Result<SymbolStatistics>
Compute symbol statistics across the entire graph.
Aggregates symbol information from all modules to provide a high-level view of symbol usage patterns.
Sourcepub fn unused_private_class_members(
&self,
) -> Result<HashMap<String, Vec<UnusedSymbol>>>
pub fn unused_private_class_members( &self, ) -> Result<HashMap<String, Vec<UnusedSymbol>>>
Get all unused private class members across the graph, grouped by class.
Private class members are safe to remove when unused, as they cannot be accessed from outside the class. This method groups results by class name for easier analysis.
Sourcepub fn all_class_members(&self) -> Result<Vec<ClassMemberInfo>>
pub fn all_class_members(&self) -> Result<Vec<ClassMemberInfo>>
Get all class members (public and private) for comprehensive analysis.
This provides complete visibility into class structure, useful for refactoring and understanding class complexity.
Sourcepub fn unused_public_class_members(&self) -> Result<Vec<UnusedSymbol>>
pub fn unused_public_class_members(&self) -> Result<Vec<UnusedSymbol>>
Get unused public class members.
Warning: Removing public members is potentially breaking for library code. Use with caution and only for application code where you control all usage.
Sourcepub fn unused_enum_members(&self) -> Result<HashMap<String, Vec<UnusedSymbol>>>
pub fn unused_enum_members(&self) -> Result<HashMap<String, Vec<UnusedSymbol>>>
Get all unused enum members across the graph, grouped by enum.
Enum members that are never referenced can often be safely removed, especially in application code. This groups results by enum for easier analysis.
Sourcepub fn all_enum_members(&self) -> Result<HashMap<String, Vec<EnumMemberInfo>>>
pub fn all_enum_members(&self) -> Result<HashMap<String, Vec<EnumMemberInfo>>>
Get all enum members (used and unused) for comprehensive enum analysis.
This provides complete visibility into enum structure, useful for understanding enum coverage and usage patterns.
Source§impl ModuleGraph
impl ModuleGraph
Trait Implementations§
Source§impl Clone for ModuleGraph
impl Clone for ModuleGraph
Source§fn clone(&self) -> ModuleGraph
fn clone(&self) -> ModuleGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ModuleGraph
impl !RefUnwindSafe for ModuleGraph
impl Send for ModuleGraph
impl Sync for ModuleGraph
impl Unpin for ModuleGraph
impl !UnwindSafe for ModuleGraph
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> 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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more