pub enum JsValue {
Show 28 variants
Constant(ConstantValue),
Url(ConstantString, JsValueUrlKind),
WellKnownObject(WellKnownObjectKind),
WellKnownFunction(WellKnownFunctionKind),
Unknown {
original_value: Option<Arc<JsValue>>,
reason: Cow<'static, str>,
has_side_effects: bool,
},
Array {
total_nodes: u32,
items: Vec<JsValue>,
mutable: bool,
},
Object {
total_nodes: u32,
parts: Vec<ObjectPart>,
mutable: bool,
},
Alternatives {
total_nodes: u32,
values: Vec<JsValue>,
logical_property: Option<LogicalProperty>,
},
Function(u32, u32, Box<JsValue>),
Concat(u32, Vec<JsValue>),
Add(u32, Vec<JsValue>),
Not(u32, Box<JsValue>),
Logical(u32, LogicalOperator, Vec<JsValue>),
Binary(u32, Box<JsValue>, BinaryOperator, Box<JsValue>),
New(u32, Box<JsValue>, Vec<JsValue>),
Call(u32, Box<JsValue>, Vec<JsValue>),
SuperCall(u32, Vec<JsValue>),
MemberCall(u32, Box<JsValue>, Box<JsValue>, Vec<JsValue>),
Member(u32, Box<JsValue>, Box<JsValue>),
Tenary(u32, Box<JsValue>, Box<JsValue>, Box<JsValue>),
Promise(u32, Box<JsValue>),
Awaited(u32, Box<JsValue>),
Iterated(u32, Box<JsValue>),
TypeOf(u32, Box<JsValue>),
Variable(Id),
Argument(u32, usize),
FreeVar(Atom),
Module(ModuleValue),
}
Expand description
TODO: Use Arc
There are 4 kinds of values: Leaves, Nested, Operations, and Placeholders
(see [JsValueMetaKind] for details). Values are processed in two phases:
- Analyze phase: We convert AST into JsValues. We don’t have contextual information so we need to insert placeholders to represent that.
- Link phase: We try to reduce a value to a constant value. The link phase has 5 substeps that are executed on each node in the graph depth-first. When a value is modified, we need to visit the new children again.
- Replace variables with their values. This replaces JsValue::Variable. No variable should be remaining after that.
- Replace placeholders with contextual information. This usually replaces JsValue::FreeVar and JsValue::Module. Some JsValue::Call on well- known functions might also be replaced. No free vars or modules should be remaining after that.
- Replace operations on well-known objects and functions. This handles JsValue::Call and JsValue::Member on well-known objects and functions.
- Replace all built-in functions with their values when they are compile-time constant.
- For optimization, any nested operations are replaced with JsValue::Unknown. So only one layer of operation remains. Any remaining operation or placeholder can be treated as unknown.
Variants§
Constant(ConstantValue)
A constant primitive value.
Url(ConstantString, JsValueUrlKind)
A constant URL object.
WellKnownObject(WellKnownObjectKind)
Some kind of well-known object (must not be an array, otherwise Array.concat needs to be changed)
WellKnownFunction(WellKnownFunctionKind)
Some kind of well-known function
Unknown
Not-analyzable value. Might contain the original value for additional info. Has a reason string for explanation.
Array
An array of nested values
Object
An object of nested values
Alternatives
A list of alternative values
Function(u32, u32, Box<JsValue>)
A function reference. The return value might contain JsValue::Argument
placeholders that need to be replaced when calling this function.
(total_node_count, func_ident, return_value)
Concat(u32, Vec<JsValue>)
A string concatenation of values.
foo.${unknownVar}.js
=> ‘foo’ + Unknown + ‘.js’
Add(u32, Vec<JsValue>)
An addition of values. This can be converted to JsValue::Concat if the type of the variable is string.
Not(u32, Box<JsValue>)
Logical negation !expr
Logical(u32, LogicalOperator, Vec<JsValue>)
Logical operator chain e. g. expr && expr
Binary(u32, Box<JsValue>, BinaryOperator, Box<JsValue>)
Binary expression e. g. expr == expr
New(u32, Box<JsValue>, Vec<JsValue>)
A constructor call.
(total_node_count, callee, args)
Call(u32, Box<JsValue>, Vec<JsValue>)
A function call without a this
context.
(total_node_count, callee, args)
SuperCall(u32, Vec<JsValue>)
A super call to the parent constructor.
(total_node_count, args)
MemberCall(u32, Box<JsValue>, Box<JsValue>, Vec<JsValue>)
A function call with a this
context.
(total_node_count, obj, prop, args)
Member(u32, Box<JsValue>, Box<JsValue>)
A member access obj[prop]
(total_node_count, obj, prop)
Tenary(u32, Box<JsValue>, Box<JsValue>, Box<JsValue>)
A tenary operator test ? cons : alt
(total_node_count, test, cons, alt)
Promise(u32, Box<JsValue>)
A promise resolving to some value
(total_node_count, value)
Awaited(u32, Box<JsValue>)
An await call (potentially) unwrapping a promise.
(total_node_count, value)
Iterated(u32, Box<JsValue>)
A for-of loop
(total_node_count, iterable)
TypeOf(u32, Box<JsValue>)
A typeof
expression.
(total_node_count, operand)
Variable(Id)
A reference to a variable.
Argument(u32, usize)
A reference to an function argument. (func_ident, arg_index)
FreeVar(Atom)
A reference to a free variable.
Module(ModuleValue)
This is a reference to a imported module.
Implementations§
Source§impl JsValue
impl JsValue
pub fn alternatives(list: Vec<JsValue>) -> Self
pub fn alternatives_with_addtional_property( list: Vec<JsValue>, logical_property: LogicalProperty, ) -> Self
pub fn concat(list: Vec<JsValue>) -> Self
pub fn add(list: Vec<JsValue>) -> Self
pub fn logical_and(list: Vec<JsValue>) -> Self
pub fn logical_or(list: Vec<JsValue>) -> Self
pub fn nullish_coalescing(list: Vec<JsValue>) -> Self
pub fn tenary(test: Box<JsValue>, cons: Box<JsValue>, alt: Box<JsValue>) -> Self
pub fn iterated(iterable: Box<JsValue>) -> Self
pub fn equal(a: Box<JsValue>, b: Box<JsValue>) -> Self
pub fn not_equal(a: Box<JsValue>, b: Box<JsValue>) -> Self
pub fn strict_equal(a: Box<JsValue>, b: Box<JsValue>) -> Self
pub fn strict_not_equal(a: Box<JsValue>, b: Box<JsValue>) -> Self
pub fn logical_not(inner: Box<JsValue>) -> Self
pub fn type_of(operand: Box<JsValue>) -> Self
pub fn array(items: Vec<JsValue>) -> Self
pub fn frozen_array(items: Vec<JsValue>) -> Self
pub fn function(func_ident: u32, return_value: Box<JsValue>) -> Self
pub fn object(list: Vec<ObjectPart>) -> Self
pub fn frozen_object(list: Vec<ObjectPart>) -> Self
pub fn new(f: Box<JsValue>, args: Vec<JsValue>) -> Self
pub fn call(f: Box<JsValue>, args: Vec<JsValue>) -> Self
pub fn super_call(args: Vec<JsValue>) -> Self
pub fn member_call(o: Box<JsValue>, p: Box<JsValue>, args: Vec<JsValue>) -> Self
pub fn member(o: Box<JsValue>, p: Box<JsValue>) -> Self
pub fn promise(operand: Box<JsValue>) -> Self
pub fn awaited(operand: Box<JsValue>) -> Self
pub fn unknown( value: impl Into<Arc<JsValue>>, side_effects: bool, reason: impl Into<Cow<'static, str>>, ) -> Self
pub fn unknown_empty( side_effects: bool, reason: impl Into<Cow<'static, str>>, ) -> Self
pub fn unknown_if( is_unknown: bool, value: JsValue, side_effects: bool, reason: impl Into<Cow<'static, str>>, ) -> Self
Source§impl JsValue
impl JsValue
pub fn has_children(&self) -> bool
pub fn total_nodes(&self) -> u32
pub fn debug_assert_total_nodes_up_to_date(&mut self)
pub fn ensure_node_limit(&mut self, limit: u32)
Source§impl JsValue
impl JsValue
Sourcepub fn make_unknown(
&mut self,
side_effects: bool,
reason: impl Into<Cow<'static, str>>,
)
pub fn make_unknown( &mut self, side_effects: bool, reason: impl Into<Cow<'static, str>>, )
Convert the value into unknown with a specific reason.
Sourcepub fn into_unknown(
self,
side_effects: bool,
reason: impl Into<Cow<'static, str>>,
) -> Self
pub fn into_unknown( self, side_effects: bool, reason: impl Into<Cow<'static, str>>, ) -> Self
Convert the owned value into unknown with a specific reason.
Sourcepub fn make_unknown_without_content(
&mut self,
side_effects: bool,
reason: impl Into<Cow<'static, str>>,
)
pub fn make_unknown_without_content( &mut self, side_effects: bool, reason: impl Into<Cow<'static, str>>, )
Convert the value into unknown with a specific reason, but don’t retain the original value.
Sourcepub fn make_nested_operations_unknown(&mut self) -> bool
pub fn make_nested_operations_unknown(&mut self) -> bool
Make all nested operations unknown when the value is an operation.
pub fn add_unknown_mutations(&mut self, side_effects: bool)
Source§impl JsValue
impl JsValue
Sourcepub fn get_defineable_name_len(&self) -> Option<usize>
pub fn get_defineable_name_len(&self) -> Option<usize>
When the value has a user-defineable name, return the length of it (in segments). Otherwise returns None.
- any free var has itself as user-defineable name: [“foo”]
- any member access adds the identifier as segment after the object: [“foo”, “prop”]
- some well-known objects/functions have a user-defineable names: [“import”]
- member calls without arguments also have a user-defineable name which is the property with
()
appended: [“foo”, “prop()”] - typeof expressions add
typeof
after the argument’s segments: [“foo”, “typeof”]
Sourcepub fn iter_defineable_name_rev(&self) -> DefineableNameIter<'_> ⓘ
pub fn iter_defineable_name_rev(&self) -> DefineableNameIter<'_> ⓘ
Returns a reverse iterator over the segments of the user-defineable
name. e. g. foo.bar().baz
would yield baz
, bar()
, foo
.
(1+2).foo.baz
would also yield baz
, foo
even while the value is
not a complete user-defineable name. Before calling this method you must
use JsValue::get_defineable_name_len to determine if the value has a
user-defineable name at all.
Sourcepub fn match_free_var_reference<'a, T>(
&self,
var_graph: Option<&VarGraph>,
free_var_references: &'a FxIndexMap<DefineableNameSegment, FxIndexMap<Vec<DefineableNameSegment>, T>>,
prop: &DefineableNameSegment,
) -> Option<&'a T>
pub fn match_free_var_reference<'a, T>( &self, var_graph: Option<&VarGraph>, free_var_references: &'a FxIndexMap<DefineableNameSegment, FxIndexMap<Vec<DefineableNameSegment>, T>>, prop: &DefineableNameSegment, ) -> Option<&'a T>
Returns any matching defined replacement that matches this value (the replacement that
matches $self.$prop
).
Optionally when passed a VarGraph, verifies that the first segment is not a local variable/was not reassigned.
Sourcepub fn match_define<'a, T>(
&self,
defines: &'a FxIndexMap<Vec<DefineableNameSegment>, T>,
) -> Option<&'a T>
pub fn match_define<'a, T>( &self, defines: &'a FxIndexMap<Vec<DefineableNameSegment>, T>, ) -> Option<&'a T>
Returns any matching defined replacement that matches this value.
Source§impl JsValue
impl JsValue
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the constant string if the value represents a constant string.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the constant bool if the value represents a constant boolean.
pub fn has_side_effects(&self) -> bool
Sourcepub fn is_truthy(&self) -> Option<bool>
pub fn is_truthy(&self) -> Option<bool>
Checks if the value is truthy. Returns None if we don’t know. Returns Some if we know if or if not the value is truthy.
Sourcepub fn is_falsy(&self) -> Option<bool>
pub fn is_falsy(&self) -> Option<bool>
Checks if the value is falsy. Returns None if we don’t know. Returns Some if we know if or if not the value is falsy.
Sourcepub fn is_nullish(&self) -> Option<bool>
pub fn is_nullish(&self) -> Option<bool>
Checks if the value is nullish (null or undefined). Returns None if we don’t know. Returns Some if we know if or if not the value is nullish.
Sourcepub fn is_not_nullish(&self) -> Option<bool>
pub fn is_not_nullish(&self) -> Option<bool>
Checks if we know that the value is not nullish. Returns None if we don’t know. Returns Some if we know if or if not the value is not nullish.
Sourcepub fn is_empty_string(&self) -> Option<bool>
pub fn is_empty_string(&self) -> Option<bool>
Checks if we know that the value is an empty string. Returns None if we don’t know. Returns Some if we know if or if not the value is an empty string.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true, if the value is unknown and storing it as condition doesn’t make sense. This is for optimization purposes.
Sourcepub fn is_string(&self) -> Option<bool>
pub fn is_string(&self) -> Option<bool>
Checks if we know that the value is a string. Returns None if we don’t know. Returns Some if we know if or if not the value is a string.
Sourcepub fn starts_with(&self, str: &str) -> Option<bool>
pub fn starts_with(&self, str: &str) -> Option<bool>
Checks if we know that the value starts with a given string. Returns None if we don’t know. Returns Some if we know if or if not the value starts with the given string.
Source§impl JsValue
impl JsValue
Sourcepub async fn visit_async_until_settled<'a, F, R, E>(
self,
visitor: &mut F,
) -> Result<(Self, bool), E>
pub async fn visit_async_until_settled<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
Visit the node and all its children with a function in a loop until the visitor returns false for the node and all children
Sourcepub async fn visit_each_children_async_until_settled<'a, F, R, E>(
self,
visitor: &mut F,
) -> Result<Self, E>
pub async fn visit_each_children_async_until_settled<'a, F, R, E>( self, visitor: &mut F, ) -> Result<Self, E>
Visit all children of the node with an async function in a loop until the visitor returns false
Sourcepub async fn visit_async<'a, F, R, E>(
self,
visitor: &mut F,
) -> Result<(Self, bool), E>
pub async fn visit_async<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
Visit the node and all its children with an async function.
Sourcepub async fn visit_each_children_async<'a, F, R, E>(
self,
visitor: &mut F,
) -> Result<(Self, bool), E>
pub async fn visit_each_children_async<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
Visit all children of the node with an async function.
Sourcepub async fn for_each_children_async<'a, F, R, E>(
self,
visitor: &mut F,
) -> Result<(Self, bool), E>
pub async fn for_each_children_async<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
Call an async function for each child of the node.
Sourcepub fn visit_mut_until_settled(
&mut self,
visitor: &mut impl FnMut(&mut JsValue) -> bool,
)
pub fn visit_mut_until_settled( &mut self, visitor: &mut impl FnMut(&mut JsValue) -> bool, )
Visit the node and all its children with a function in a loop until the visitor returns false
Sourcepub fn visit_mut(
&mut self,
visitor: &mut impl FnMut(&mut JsValue) -> bool,
) -> bool
pub fn visit_mut( &mut self, visitor: &mut impl FnMut(&mut JsValue) -> bool, ) -> bool
Visit the node and all its children with a function.
Sourcepub fn visit_mut_conditional(
&mut self,
condition: impl Fn(&JsValue) -> bool,
visitor: &mut impl FnMut(&mut JsValue) -> bool,
) -> bool
pub fn visit_mut_conditional( &mut self, condition: impl Fn(&JsValue) -> bool, visitor: &mut impl FnMut(&mut JsValue) -> bool, ) -> bool
Visit all children of the node with a function. Only visits nodes where the condition is true.
Sourcepub fn for_each_children_mut(
&mut self,
visitor: &mut impl FnMut(&mut JsValue) -> bool,
) -> bool
pub fn for_each_children_mut( &mut self, visitor: &mut impl FnMut(&mut JsValue) -> bool, ) -> bool
Calls a function for each child of the node. Allows mutating the node. Updates the total nodes count after mutation.
Sourcepub fn for_each_early_children_mut(
&mut self,
visitor: &mut impl FnMut(&mut JsValue) -> bool,
) -> bool
pub fn for_each_early_children_mut( &mut self, visitor: &mut impl FnMut(&mut JsValue) -> bool, ) -> bool
Calls a function for only early children. Allows mutating the node. Updates the total nodes count after mutation.
Sourcepub fn for_each_late_children_mut(
&mut self,
visitor: &mut impl FnMut(&mut JsValue) -> bool,
) -> bool
pub fn for_each_late_children_mut( &mut self, visitor: &mut impl FnMut(&mut JsValue) -> bool, ) -> bool
Calls a function for only late children. Allows mutating the node. Updates the total nodes count after mutation.
Sourcepub fn visit(&self, visitor: &mut impl FnMut(&JsValue))
pub fn visit(&self, visitor: &mut impl FnMut(&JsValue))
Visit the node and all its children with a function.
Sourcepub fn for_each_children(&self, visitor: &mut impl FnMut(&JsValue))
pub fn for_each_children(&self, visitor: &mut impl FnMut(&JsValue))
Calls a function for all children of the node.
Trait Implementations§
Source§impl From<&CompileTimeDefineValue> for JsValue
impl From<&CompileTimeDefineValue> for JsValue
Source§fn from(v: &CompileTimeDefineValue) -> Self
fn from(v: &CompileTimeDefineValue) -> Self
Source§impl From<&FreeVarReference> for JsValue
impl From<&FreeVarReference> for JsValue
Source§fn from(v: &FreeVarReference) -> Self
fn from(v: &FreeVarReference) -> Self
Source§impl From<ConstantValue> for JsValue
impl From<ConstantValue> for JsValue
Source§fn from(v: ConstantValue) -> Self
fn from(v: ConstantValue) -> Self
impl Eq for JsValue
impl StructuralPartialEq for JsValue
Auto Trait Implementations§
impl Freeze for JsValue
impl RefUnwindSafe for JsValue
impl Send for JsValue
impl Sync for JsValue
impl Unpin for JsValue
impl UnwindSafe for JsValue
Blanket Implementations§
§impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
§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
§impl<T> CallHasher for T
impl<T> CallHasher for 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
Source§impl<T> DynamicEqHash for T
impl<T> DynamicEqHash for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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> ImplicitClone for Twhere
T: Clone,
impl<T> ImplicitClone for Twhere
T: Clone,
fn clone_quote_var(&self) -> Self
§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> 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> Pointable for T
impl<T> Pointable for T
§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.§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more