pub struct TraverseCtx<'a, State> {
pub state: State,
pub ancestry: TraverseAncestry<'a>,
pub scoping: TraverseScoping<'a>,
pub ast: AstBuilder<'a>,
}Expand description
AST traversal utilities Traverse context.
Passed to all AST visitor functions.
Provides ability to:
- Query parent/ancestor of current node via
parent,ancestor,ancestors. - Get scopes tree and symbols table via
scopingandscoping_mut,ancestor_scopes. - Create AST nodes via AST builder
ast. - Allocate into arena via
alloc.
§Namespaced APIs
All APIs are provided via 2 routes:
- Directly on
TraverseCtx. - Via “namespaces”.
| Direct | Namespaced |
|---|---|
ctx.parent() | ctx.ancestry.parent() |
ctx.current_scope_id() | ctx.scoping.current_scope_id() |
ctx.alloc(thing) | ctx.ast.alloc(thing) |
Purpose of the “namespaces” is to support if you want to mutate scope tree or symbol table
while holding an &Ancestor, or AST nodes obtained from an &Ancestor.
For example, this will not compile because it attempts to borrow ctx
immutably and mutably at same time:
use oxc_ast::ast::*;
use oxc_traverse::{Ancestor, Traverse, TraverseCtx};
struct MyTransform;
impl<'a> Traverse<'a> for MyTransform {
fn enter_unary_expression(&mut self, unary_expr: &mut UnaryExpression<'a>, ctx: &mut TraverseCtx<'a>) {
// `right` is ultimately borrowed from `ctx`
let right = match ctx.parent() {
Ancestor::BinaryExpressionLeft(bin_expr) => bin_expr.right(),
_ => return,
};
// Won't compile! `ctx.scopes_mut()` attempts to mut borrow `ctx`
// while it's already borrowed by `right`.
let scope_tree_mut = ctx.scopes_mut();
// Use `right` later on
dbg!(right);
}
}You can fix this by using the “namespaced” methods instead.
This works because you can borrow ctx.ancestry and ctx.scoping simultaneously:
use oxc_ast::ast::*;
use oxc_traverse::{Ancestor, Traverse, TraverseCtx};
struct MyTransform;
impl<'a> Traverse<'a, ()> for MyTransform {
fn enter_unary_expression(&mut self, unary_expr: &mut UnaryExpression<'a>, ctx: &mut TraverseCtx<'a, ()>) {
let right = match ctx.ancestry.parent() {
Ancestor::BinaryExpressionLeft(bin_expr) => bin_expr.right(),
_ => return,
};
let scoping_mut = ctx.scoping.scoping_mut();
dbg!(right);
}
}Fields§
§state: State§ancestry: TraverseAncestry<'a>§scoping: TraverseScoping<'a>§ast: AstBuilder<'a>Implementations§
Source§impl<'a, State> TraverseCtx<'a, State>
impl<'a, State> TraverseCtx<'a, State>
Sourcepub fn parent<'t>(&'t self) -> Ancestor<'a, 't>
pub fn parent<'t>(&'t self) -> Ancestor<'a, 't>
Get parent of current node.
Shortcut for ctx.ancestry.parent.
Sourcepub fn ancestor<'t>(&'t self, level: usize) -> Ancestor<'a, 't>
pub fn ancestor<'t>(&'t self, level: usize) -> Ancestor<'a, 't>
Get ancestor of current node.
level is number of levels above parent.
ancestor(0) is equivalent to parent() (but better to use parent() as it’s more efficient).
If level is out of bounds (above Program), returns Ancestor::None.
Shortcut for ctx.ancestry.ancestor.
Sourcepub fn ancestors<'t>(&'t self) -> impl Iterator<Item = Ancestor<'a, 't>>
pub fn ancestors<'t>(&'t self) -> impl Iterator<Item = Ancestor<'a, 't>>
Get iterator over ancestors, starting with parent and working up.
Last Ancestor returned will be Program. Ancestor::None is not included in iteration.
Shortcut for ctx.ancestry.ancestors.
Sourcepub fn ancestors_depth(&self) -> usize
pub fn ancestors_depth(&self) -> usize
Get depth in the AST.
Count includes current node. i.e. in Program, depth is 1.
Shortcut for self.ancestry.ancestors_depth.
Sourcepub fn current_scope_id(&self) -> ScopeId
pub fn current_scope_id(&self) -> ScopeId
Get current scope ID.
Shortcut for ctx.scoping.current_scope_id.
Sourcepub fn current_hoist_scope_id(&self) -> ScopeId
pub fn current_hoist_scope_id(&self) -> ScopeId
Get current var hoisting scope ID.
Shortcut for ctx.scoping.current_hoist_scope_id.
Sourcepub fn current_block_scope_id(&self) -> ScopeId
pub fn current_block_scope_id(&self) -> ScopeId
Get current block scope ID.
Shortcut for ctx.scoping.current_block_scope_id.
Sourcepub fn current_scope_flags(&self) -> ScopeFlags
pub fn current_scope_flags(&self) -> ScopeFlags
Get current scope flags.
Shortcut for ctx.scoping.current_scope_flags.
Sourcepub fn scoping_mut(&mut self) -> &mut Scoping
pub fn scoping_mut(&mut self) -> &mut Scoping
Get mutable scopes tree.
Shortcut for ctx.scoping.scopes_mut.
Sourcepub fn ancestor_scopes(&self) -> impl Iterator<Item = ScopeId>
pub fn ancestor_scopes(&self) -> impl Iterator<Item = ScopeId>
Get iterator over scopes, starting with current scope and working up.
This is a shortcut for ctx.scoping.parent_scopes.
Sourcepub fn create_child_scope(
&mut self,
parent_id: ScopeId,
flags: ScopeFlags,
) -> ScopeId
pub fn create_child_scope( &mut self, parent_id: ScopeId, flags: ScopeFlags, ) -> ScopeId
Create new scope as child of provided scope.
flags provided are amended to inherit from parent scope’s flags.
This is a shortcut for ctx.scoping.create_child_scope.
Sourcepub fn create_child_scope_of_current(&mut self, flags: ScopeFlags) -> ScopeId
pub fn create_child_scope_of_current(&mut self, flags: ScopeFlags) -> ScopeId
Create new scope as child of current scope.
flags provided are amended to inherit from parent scope’s flags.
This is a shortcut for ctx.scoping.create_child_scope_of_current.
Sourcepub fn insert_scope_below_statement(
&mut self,
stmt: &Statement<'_>,
flags: ScopeFlags,
) -> ScopeId
pub fn insert_scope_below_statement( &mut self, stmt: &Statement<'_>, flags: ScopeFlags, ) -> ScopeId
Insert a scope into scope tree below a statement.
Statement must be in current scope. New scope is created as child of current scope. All child scopes of the statement are reassigned to be children of the new scope.
flags provided are amended to inherit from parent scope’s flags.
This is a shortcut for ctx.scoping.insert_scope_below_statement.
Sourcepub fn insert_scope_below_statement_from_scope_id(
&mut self,
stmt: &Statement<'_>,
scope_id: ScopeId,
flags: ScopeFlags,
) -> ScopeId
pub fn insert_scope_below_statement_from_scope_id( &mut self, stmt: &Statement<'_>, scope_id: ScopeId, flags: ScopeFlags, ) -> ScopeId
Insert a scope into scope tree below a statement.
Statement must be in provided scope. New scope is created as child of the provided scope. All child scopes of the statement are reassigned to be children of the new scope.
flags provided are amended to inherit from parent scope’s flags.
This is a shortcut for ctx.scoping.insert_scope_below_statement_from_scope_id.
Sourcepub fn insert_scope_below_expression(
&mut self,
expr: &Expression<'_>,
flags: ScopeFlags,
) -> ScopeId
pub fn insert_scope_below_expression( &mut self, expr: &Expression<'_>, flags: ScopeFlags, ) -> ScopeId
Insert a scope into scope tree below an expression.
Expression must be in current scope. New scope is created as child of current scope. All child scopes of the expression are reassigned to be children of the new scope.
flags provided are amended to inherit from parent scope’s flags.
This is a shortcut for ctx.scoping.insert_scope_below_expression.
Sourcepub fn insert_scope_below_statements(
&mut self,
stmts: &Vec<'_, Statement<'_>>,
flags: ScopeFlags,
) -> ScopeId
pub fn insert_scope_below_statements( &mut self, stmts: &Vec<'_, Statement<'_>>, flags: ScopeFlags, ) -> ScopeId
Insert a scope into scope tree below a Vec of statements.
Statements must be in current scope. New scope is created as child of current scope. All child scopes of the statement are reassigned to be children of the new scope.
flags provided are amended to inherit from parent scope’s flags.
This is a shortcut for ctx.scoping.insert_scope_below_statements.
Sourcepub fn insert_scope_between(
&mut self,
parent_id: ScopeId,
child_id: ScopeId,
flags: ScopeFlags,
) -> ScopeId
pub fn insert_scope_between( &mut self, parent_id: ScopeId, child_id: ScopeId, flags: ScopeFlags, ) -> ScopeId
Insert a scope between a parent and a child scope.
For example, given the following scopes
parentScope1: {
childScope: { }
childScope2: { }
}and calling this function with parentScope1 and childScope,
the resulting scopes will be:
parentScope1: {
newScope: {
childScope: { }
}
childScope2: { }
}This is a shortcut for ctx.scoping.insert_scope_between.
Sourcepub fn remove_scope_for_expression(
&mut self,
scope_id: ScopeId,
expr: &Expression<'_>,
)
pub fn remove_scope_for_expression( &mut self, scope_id: ScopeId, expr: &Expression<'_>, )
Remove scope for an expression from the scope chain.
Delete the scope and set parent of its child scopes to its parent scope. e.g.:
- Starting scopes parentage
A -> B,B -> C,B -> D. - Remove scope
Bfrom chain. - End result: scopes
A -> C,A -> D.
Use this when removing an expression which owns a scope, without removing its children.
For example when unwrapping (() => foo)() to just foo.
foo here could be an expression which itself contains scopes.
This is a shortcut for ctx.scoping.remove_scope_for_expression.
Sourcepub fn generate_binding(
&mut self,
name: Atom<'a>,
scope_id: ScopeId,
flags: SymbolFlags,
) -> BoundIdentifier<'a>
pub fn generate_binding( &mut self, name: Atom<'a>, scope_id: ScopeId, flags: SymbolFlags, ) -> BoundIdentifier<'a>
Generate binding.
Creates a symbol with the provided name and flags and adds it to the specified scope.
This is a shortcut for ctx.scoping.generate_binding.
Sourcepub fn generate_binding_in_current_scope(
&mut self,
name: Atom<'a>,
flags: SymbolFlags,
) -> BoundIdentifier<'a>
pub fn generate_binding_in_current_scope( &mut self, name: Atom<'a>, flags: SymbolFlags, ) -> BoundIdentifier<'a>
Generate binding in current scope.
Creates a symbol with the provided name and flags and adds it to the current scope.
This is a shortcut for ctx.scoping.generate_binding_in_current_scope.
Sourcepub fn generate_uid_name(&mut self, name: &str) -> Atom<'a>
pub fn generate_uid_name(&mut self, name: &str) -> Atom<'a>
Generate UID var name.
Finds a unique variable name which does clash with any other variables used in the program.
See TraverseScoping::generate_uid_name for important information on how UIDs are generated.
There are some potential “gotchas”.
This is a shortcut for ctx.scoping.generate_uid_name.
Sourcepub fn generate_uid(
&mut self,
name: &str,
scope_id: ScopeId,
flags: SymbolFlags,
) -> BoundIdentifier<'a>
pub fn generate_uid( &mut self, name: &str, scope_id: ScopeId, flags: SymbolFlags, ) -> BoundIdentifier<'a>
Generate UID.
See also comments on TraverseScoping::generate_uid_name for important information
on how UIDs are generated. There are some potential “gotchas”.
Sourcepub fn generate_uid_in_current_scope(
&mut self,
name: &str,
flags: SymbolFlags,
) -> BoundIdentifier<'a>
pub fn generate_uid_in_current_scope( &mut self, name: &str, flags: SymbolFlags, ) -> BoundIdentifier<'a>
Generate UID in current scope.
See also comments on TraverseScoping::generate_uid_name for important information
on how UIDs are generated. There are some potential “gotchas”.
Sourcepub fn generate_uid_in_root_scope(
&mut self,
name: &str,
flags: SymbolFlags,
) -> BoundIdentifier<'a>
pub fn generate_uid_in_root_scope( &mut self, name: &str, flags: SymbolFlags, ) -> BoundIdentifier<'a>
Generate UID in root scope.
See also comments on TraverseScoping::generate_uid_name for important information
on how UIDs are generated. There are some potential “gotchas”.
Sourcepub fn generate_uid_based_on_node<N>(
&mut self,
node: &N,
scope_id: ScopeId,
flags: SymbolFlags,
) -> BoundIdentifier<'a>where
N: GatherNodeParts<'a>,
pub fn generate_uid_based_on_node<N>(
&mut self,
node: &N,
scope_id: ScopeId,
flags: SymbolFlags,
) -> BoundIdentifier<'a>where
N: GatherNodeParts<'a>,
Generate UID based on node.
Recursively gathers the identifying names of a node, and joins them with $.
Based on Babel’s scope.generateUidBasedOnNode logic.
https://github.com/babel/babel/blob/419644f27c5c59deb19e71aaabd417a3bc5483ca/packages/babel-traverse/src/scope/index.ts#L543
Sourcepub fn generate_uid_in_current_scope_based_on_node<N>(
&mut self,
node: &N,
flags: SymbolFlags,
) -> BoundIdentifier<'a>where
N: GatherNodeParts<'a>,
pub fn generate_uid_in_current_scope_based_on_node<N>(
&mut self,
node: &N,
flags: SymbolFlags,
) -> BoundIdentifier<'a>where
N: GatherNodeParts<'a>,
Generate UID in current scope based on node.
See also comments on TraverseScoping::generate_uid_name for important information
on how UIDs are generated. There are some potential “gotchas”.
Sourcepub fn generate_uid_in_current_hoist_scope(
&mut self,
name: &str,
) -> BoundIdentifier<'a>
pub fn generate_uid_in_current_hoist_scope( &mut self, name: &str, ) -> BoundIdentifier<'a>
Generate UID in current hoist scope.
See also comments on TraverseScoping::generate_uid_name for important information
on how UIDs are generated. There are some potential “gotchas”.
Sourcepub fn generate_uid_in_current_hoist_scope_based_on_node<N>(
&mut self,
node: &N,
) -> BoundIdentifier<'a>where
N: GatherNodeParts<'a>,
pub fn generate_uid_in_current_hoist_scope_based_on_node<N>(
&mut self,
node: &N,
) -> BoundIdentifier<'a>where
N: GatherNodeParts<'a>,
Generate UID in current hoist scope based on node.
See also comments on TraverseScoping::generate_uid_name for important information
on how UIDs are generated. There are some potential “gotchas”.
Sourcepub fn create_bound_reference(
&mut self,
symbol_id: SymbolId,
flags: ReferenceFlags,
) -> ReferenceId
pub fn create_bound_reference( &mut self, symbol_id: SymbolId, flags: ReferenceFlags, ) -> ReferenceId
Create a reference bound to a SymbolId.
This is a shortcut for ctx.scoping.create_bound_reference.
Sourcepub fn create_bound_ident_reference(
&mut self,
span: Span,
name: Atom<'a>,
symbol_id: SymbolId,
flags: ReferenceFlags,
) -> IdentifierReference<'a>
pub fn create_bound_ident_reference( &mut self, span: Span, name: Atom<'a>, symbol_id: SymbolId, flags: ReferenceFlags, ) -> IdentifierReference<'a>
Create an IdentifierReference bound to a SymbolId.
Sourcepub fn create_bound_ident_expr(
&mut self,
span: Span,
name: Atom<'a>,
symbol_id: SymbolId,
flags: ReferenceFlags,
) -> Expression<'a>
pub fn create_bound_ident_expr( &mut self, span: Span, name: Atom<'a>, symbol_id: SymbolId, flags: ReferenceFlags, ) -> Expression<'a>
Create an Expression::Identifier bound to a SymbolId.
Sourcepub fn create_unbound_reference(
&mut self,
name: &str,
flags: ReferenceFlags,
) -> ReferenceId
pub fn create_unbound_reference( &mut self, name: &str, flags: ReferenceFlags, ) -> ReferenceId
Create an unbound reference.
This is a shortcut for ctx.scoping.create_unbound_reference.
Sourcepub fn create_unbound_ident_reference(
&mut self,
span: Span,
name: Atom<'a>,
flags: ReferenceFlags,
) -> IdentifierReference<'a>
pub fn create_unbound_ident_reference( &mut self, span: Span, name: Atom<'a>, flags: ReferenceFlags, ) -> IdentifierReference<'a>
Create an unbound IdentifierReference.
Sourcepub fn create_unbound_ident_expr(
&mut self,
span: Span,
name: Atom<'a>,
flags: ReferenceFlags,
) -> Expression<'a>
pub fn create_unbound_ident_expr( &mut self, span: Span, name: Atom<'a>, flags: ReferenceFlags, ) -> Expression<'a>
Create an unbound Expression::Identifier.
Sourcepub fn create_reference(
&mut self,
name: &str,
symbol_id: Option<SymbolId>,
flags: ReferenceFlags,
) -> ReferenceId
pub fn create_reference( &mut self, name: &str, symbol_id: Option<SymbolId>, flags: ReferenceFlags, ) -> ReferenceId
Create a reference optionally bound to a SymbolId.
If you know if there’s a SymbolId or not, prefer TraverseCtx::create_bound_reference
or TraverseCtx::create_unbound_reference.
This is a shortcut for ctx.scoping.create_reference.
Sourcepub fn create_ident_reference(
&mut self,
span: Span,
name: Atom<'a>,
symbol_id: Option<SymbolId>,
flags: ReferenceFlags,
) -> IdentifierReference<'a>
pub fn create_ident_reference( &mut self, span: Span, name: Atom<'a>, symbol_id: Option<SymbolId>, flags: ReferenceFlags, ) -> IdentifierReference<'a>
Create an IdentifierReference optionally bound to a SymbolId.
If you know if there’s a SymbolId or not, prefer TraverseCtx::create_bound_ident_reference
or TraverseCtx::create_unbound_ident_reference.
Sourcepub fn create_ident_expr(
&mut self,
span: Span,
name: Atom<'a>,
symbol_id: Option<SymbolId>,
flags: ReferenceFlags,
) -> Expression<'a>
pub fn create_ident_expr( &mut self, span: Span, name: Atom<'a>, symbol_id: Option<SymbolId>, flags: ReferenceFlags, ) -> Expression<'a>
Create an Expression::Identifier optionally bound to a SymbolId.
If you know if there’s a SymbolId or not, prefer TraverseCtx::create_bound_ident_expr
or TraverseCtx::create_unbound_ident_expr.
Sourcepub fn create_reference_in_current_scope(
&mut self,
name: &str,
flags: ReferenceFlags,
) -> ReferenceId
pub fn create_reference_in_current_scope( &mut self, name: &str, flags: ReferenceFlags, ) -> ReferenceId
Create reference in current scope, looking up binding for name,
This is a shortcut for ctx.scoping.create_reference_in_current_scope.
Sourcepub fn delete_reference(&mut self, reference_id: ReferenceId, name: &str)
pub fn delete_reference(&mut self, reference_id: ReferenceId, name: &str)
Delete a reference.
Provided name must match reference_id.
This is a shortcut for ctx.scoping.delete_reference.
Sourcepub fn delete_reference_for_identifier(
&mut self,
ident: &IdentifierReference<'_>,
)
pub fn delete_reference_for_identifier( &mut self, ident: &IdentifierReference<'_>, )
Delete reference for an IdentifierReference.
This is a shortcut for ctx.scoping.delete_reference_for_identifier.
Auto Trait Implementations§
impl<'a, State> Freeze for TraverseCtx<'a, State>where
State: Freeze,
impl<'a, State> !RefUnwindSafe for TraverseCtx<'a, State>
impl<'a, State> !Send for TraverseCtx<'a, State>
impl<'a, State> !Sync for TraverseCtx<'a, State>
impl<'a, State> Unpin for TraverseCtx<'a, State>where
State: Unpin,
impl<'a, State> !UnwindSafe for TraverseCtx<'a, State>
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 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