pub struct StateManager {Show 47 fields
pub(crate) _state: PluginPass,
pub(crate) import_paths: FxHashSet<String>,
pub(crate) stylex_import: FxHashSet<ImportSources>,
pub(crate) import_specifiers: Vec<String>,
pub(crate) stylex_props_import: FxHashSet<Atom>,
pub(crate) stylex_attrs_import: FxHashSet<Atom>,
pub(crate) stylex_create_import: FxHashSet<Atom>,
pub(crate) stylex_first_that_works_import: FxHashSet<Atom>,
pub(crate) stylex_keyframes_import: FxHashSet<Atom>,
pub(crate) stylex_define_vars_import: FxHashSet<Atom>,
pub(crate) stylex_define_marker_import: FxHashSet<Atom>,
pub(crate) stylex_define_consts_import: FxHashSet<Atom>,
pub(crate) stylex_create_theme_import: FxHashSet<Atom>,
pub(crate) stylex_position_try_import: FxHashSet<Atom>,
pub(crate) stylex_view_transition_class_import: FxHashSet<Atom>,
pub(crate) stylex_default_marker_import: FxHashSet<Atom>,
pub(crate) stylex_when_import: FxHashSet<Atom>,
pub(crate) stylex_types_import: FxHashSet<Atom>,
pub(crate) stylex_env_import: FxHashSet<Atom>,
pub(crate) inject_import_inserted: Option<(Ident, Ident)>,
pub(crate) export_id: Option<String>,
pub(crate) seen_module_source_code: Option<Box<(Program, Option<String>)>>,
pub(crate) class_name_declarations: Vec<Ident>,
pub(crate) function_name_declarations: Vec<Ident>,
pub(crate) declarations: Vec<VarDeclarator>,
pub(crate) top_level_expressions: Vec<TopLevelExpression>,
pub all_call_expressions: FxHashMap<u64, CallExpr>,
pub(crate) var_decl_count_map: FxHashMap<Atom, i16>,
pub(crate) seen: FxHashMap<u64, Rc<SeenValueWithVarDeclCount>>,
pub(crate) css_property_seen: FxHashMap<String, String>,
pub(crate) span_cache: FxHashMap<u64, Span>,
pub(crate) jsx_spread_attr_exprs_map: FxHashMap<Expr, Vec<JSXAttrOrSpread>>,
pub(crate) style_map: FxHashMap<String, Rc<IndexMap<String, Rc<IndexMap<String, Rc<FlatCompiledStylesValue>>>>>>,
pub(crate) style_vars: FxHashMap<String, VarDeclarator>,
pub(crate) style_vars_to_keep: IndexSet<StyleVarsToKeep>,
pub(crate) member_object_ident_count_map: FxHashMap<Atom, i16>,
pub(crate) in_stylex_create: bool,
pub(crate) options: StyleXStateOptions,
pub metadata: IndexMap<String, IndexSet<MetaData>>,
pub(crate) styles_to_inject: IndexMap<u64, Vec<ModuleItem>>,
pub(crate) prepend_include_module_items: Vec<ModuleItem>,
pub(crate) hoisted_module_items: Vec<ModuleItem>,
pub(crate) prepend_import_module_items: Vec<ModuleItem>,
pub(crate) other_injected_css_rules: IndexMap<String, Rc<InjectableStyleKind>>,
pub(crate) top_imports: Vec<ImportDecl>,
pub(crate) named_exports: FxHashSet<NamedExport>,
pub cycle: TransformationCycle,
}Fields§
§_state: PluginPass§import_paths: FxHashSet<String>§stylex_import: FxHashSet<ImportSources>§import_specifiers: Vec<String>§stylex_props_import: FxHashSet<Atom>§stylex_attrs_import: FxHashSet<Atom>§stylex_create_import: FxHashSet<Atom>§stylex_first_that_works_import: FxHashSet<Atom>§stylex_keyframes_import: FxHashSet<Atom>§stylex_define_vars_import: FxHashSet<Atom>§stylex_define_marker_import: FxHashSet<Atom>§stylex_define_consts_import: FxHashSet<Atom>§stylex_create_theme_import: FxHashSet<Atom>§stylex_position_try_import: FxHashSet<Atom>§stylex_view_transition_class_import: FxHashSet<Atom>§stylex_default_marker_import: FxHashSet<Atom>§stylex_when_import: FxHashSet<Atom>§stylex_types_import: FxHashSet<Atom>§stylex_env_import: FxHashSet<Atom>§inject_import_inserted: Option<(Ident, Ident)>§export_id: Option<String>§seen_module_source_code: Option<Box<(Program, Option<String>)>>§class_name_declarations: Vec<Ident>§function_name_declarations: Vec<Ident>§declarations: Vec<VarDeclarator>§top_level_expressions: Vec<TopLevelExpression>§all_call_expressions: FxHashMap<u64, CallExpr>§var_decl_count_map: FxHashMap<Atom, i16>§seen: FxHashMap<u64, Rc<SeenValueWithVarDeclCount>>§css_property_seen: FxHashMap<String, String>§span_cache: FxHashMap<u64, Span>§jsx_spread_attr_exprs_map: FxHashMap<Expr, Vec<JSXAttrOrSpread>>§style_map: FxHashMap<String, Rc<IndexMap<String, Rc<IndexMap<String, Rc<FlatCompiledStylesValue>>>>>>§style_vars: FxHashMap<String, VarDeclarator>§style_vars_to_keep: IndexSet<StyleVarsToKeep>§member_object_ident_count_map: FxHashMap<Atom, i16>§in_stylex_create: bool§options: StyleXStateOptions§metadata: IndexMap<String, IndexSet<MetaData>>§styles_to_inject: IndexMap<u64, Vec<ModuleItem>>§prepend_include_module_items: Vec<ModuleItem>§hoisted_module_items: Vec<ModuleItem>§prepend_import_module_items: Vec<ModuleItem>§other_injected_css_rules: IndexMap<String, Rc<InjectableStyleKind>>§top_imports: Vec<ImportDecl>§named_exports: FxHashSet<NamedExport>§cycle: TransformationCycleImplementations§
Source§impl StateManager
impl StateManager
pub fn new(stylex_options: StyleXOptions) -> Self
Sourcepub(crate) fn apply_stylex_env(
&self,
identifiers: &mut FxHashMap<Atom, Box<FunctionConfigType>>,
member_expressions: &mut FxHashMap<ImportSources, Box<FxHashMap<Atom, Box<FunctionConfigType>>>>,
)
pub(crate) fn apply_stylex_env( &self, identifiers: &mut FxHashMap<Atom, Box<FunctionConfigType>>, member_expressions: &mut FxHashMap<ImportSources, Box<FxHashMap<Atom, Box<FunctionConfigType>>>>, )
Applies the env configuration to the given identifiers and member_expressions maps.
This is the Rust equivalent of the JavaScript applyStylexEnv method.
Sourcepub(crate) fn get_seen_module_source_code(
&self,
) -> Option<(&Module, &Option<String>)>
pub(crate) fn get_seen_module_source_code( &self, ) -> Option<(&Module, &Option<String>)>
Gets the source code program if it exists and is not yet normalized
Sourcepub(crate) fn set_seen_module_source_code(
&mut self,
module: &Module,
source_code: Option<String>,
)
pub(crate) fn set_seen_module_source_code( &mut self, module: &Module, source_code: Option<String>, )
Sets the source code module (marks as not yet normalized)
pub fn import_as(&self, import: &str) -> Option<String>
pub fn import_sources(&self) -> Vec<ImportSources>
pub fn import_sources_stringified(&self) -> Vec<String>
pub fn stylex_import_stringified(&self) -> Vec<String>
pub(crate) fn is_test(&self) -> bool
pub(crate) fn is_dev(&self) -> bool
pub(crate) fn is_debug(&self) -> bool
pub(crate) fn enable_inlined_conditional_merge(&self) -> bool
pub(crate) fn get_short_filename(&self) -> String
pub(crate) fn get_filename(&self) -> &str
pub(crate) fn get_filename_for_hashing( &self, package_json_seen: &mut FxHashMap<String, PackageJsonExtended>, ) -> Option<String>
pub(crate) fn get_package_name_and_path( filepath: &str, package_json_seen: &mut FxHashMap<String, PackageJsonExtended>, ) -> Option<(Option<String>, String)>
pub(crate) fn get_canonical_file_path( &self, file_path: &str, package_json_seen: &mut FxHashMap<String, PackageJsonExtended>, ) -> String
pub(crate) fn import_path_resolver( &self, import_path: &str, package_json_seen: &mut FxHashMap<String, PackageJsonExtended>, ) -> ImportPathResolution
pub(crate) fn find_top_level_expr( &self, call: &CallExpr, extended_predicate_fn: impl Fn(&TopLevelExpression) -> bool, kind: Option<TopLevelExpressionKind>, ) -> Option<&TopLevelExpression>
pub(crate) fn find_call_declaration( &self, call: &CallExpr, ) -> Option<&VarDeclarator>
pub(crate) fn register_styles( &mut self, call: &CallExpr, style: &IndexMap<String, Rc<InjectableStyleKind>>, ast: &Expr, fallback_ast: Option<&Expr>, )
fn setup_injection_imports(&mut self) -> Ident
fn update_references( &mut self, call: &CallExpr, ast: &Expr, _fallback_ast: Option<&Expr>, )
fn add_style(&mut self, metadata: &MetaData)
fn add_style_to_inject( &mut self, metadata: &MetaData, inject_var_ident: &Ident, ast: &Expr, fallback_ast: Option<&Expr>, )
pub(crate) fn get_treeshake_compensation(&self) -> bool
pub fn combine(&mut self, other: &Self)
Trait Implementations§
Source§impl Clone for StateManager
impl Clone for StateManager
Source§fn clone(&self) -> StateManager
fn clone(&self) -> StateManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StateManager
impl Debug for StateManager
Source§impl Default for StateManager
impl Default for StateManager
Source§impl StyleOptions for StateManager
impl StyleOptions for StateManager
Source§fn options(&self) -> &StyleXStateOptions
fn options(&self) -> &StyleXStateOptions
Source§fn css_property_seen(&self) -> &FxHashMap<String, String>
fn css_property_seen(&self) -> &FxHashMap<String, String>
Source§fn css_property_seen_mut(&mut self) -> &mut FxHashMap<String, String>
fn css_property_seen_mut(&mut self) -> &mut FxHashMap<String, String>
Source§fn other_injected_css_rules(&self) -> &InjectableStylesMap
fn other_injected_css_rules(&self) -> &InjectableStylesMap
Source§fn other_injected_css_rules_mut(&mut self) -> &mut InjectableStylesMap
fn other_injected_css_rules_mut(&mut self) -> &mut InjectableStylesMap
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Auto Trait Implementations§
impl Freeze for StateManager
impl !RefUnwindSafe for StateManager
impl !Send for StateManager
impl !Sync for StateManager
impl Unpin for StateManager
impl UnsafeUnpin for StateManager
impl !UnwindSafe for StateManager
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§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 more§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§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§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();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§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();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§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();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§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();§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>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§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);§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointee for T
impl<T> Pointee for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.