Enum JsValue

Source
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.

Fields

§original_value: Option<Arc<JsValue>>
§reason: Cow<'static, str>
§has_side_effects: bool
§

Array

An array of nested values

Fields

§total_nodes: u32
§items: Vec<JsValue>
§mutable: bool
§

Object

An object of nested values

Fields

§total_nodes: u32
§mutable: bool
§

Alternatives

A list of alternative values

Fields

§total_nodes: u32
§values: Vec<JsValue>
§logical_property: Option<LogicalProperty>
§

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

Source

pub fn alternatives(list: Vec<JsValue>) -> Self

Source

pub fn alternatives_with_addtional_property( list: Vec<JsValue>, logical_property: LogicalProperty, ) -> Self

Source

pub fn concat(list: Vec<JsValue>) -> Self

Source

pub fn add(list: Vec<JsValue>) -> Self

Source

pub fn logical_and(list: Vec<JsValue>) -> Self

Source

pub fn logical_or(list: Vec<JsValue>) -> Self

Source

pub fn nullish_coalescing(list: Vec<JsValue>) -> Self

Source

pub fn tenary(test: Box<JsValue>, cons: Box<JsValue>, alt: Box<JsValue>) -> Self

Source

pub fn iterated(iterable: Box<JsValue>) -> Self

Source

pub fn equal(a: Box<JsValue>, b: Box<JsValue>) -> Self

Source

pub fn not_equal(a: Box<JsValue>, b: Box<JsValue>) -> Self

Source

pub fn strict_equal(a: Box<JsValue>, b: Box<JsValue>) -> Self

Source

pub fn strict_not_equal(a: Box<JsValue>, b: Box<JsValue>) -> Self

Source

pub fn logical_not(inner: Box<JsValue>) -> Self

Source

pub fn type_of(operand: Box<JsValue>) -> Self

Source

pub fn array(items: Vec<JsValue>) -> Self

Source

pub fn frozen_array(items: Vec<JsValue>) -> Self

Source

pub fn function(func_ident: u32, return_value: Box<JsValue>) -> Self

Source

pub fn object(list: Vec<ObjectPart>) -> Self

Source

pub fn frozen_object(list: Vec<ObjectPart>) -> Self

Source

pub fn new(f: Box<JsValue>, args: Vec<JsValue>) -> Self

Source

pub fn call(f: Box<JsValue>, args: Vec<JsValue>) -> Self

Source

pub fn super_call(args: Vec<JsValue>) -> Self

Source

pub fn member_call(o: Box<JsValue>, p: Box<JsValue>, args: Vec<JsValue>) -> Self

Source

pub fn member(o: Box<JsValue>, p: Box<JsValue>) -> Self

Source

pub fn promise(operand: Box<JsValue>) -> Self

Source

pub fn awaited(operand: Box<JsValue>) -> Self

Source

pub fn unknown( value: impl Into<Arc<JsValue>>, side_effects: bool, reason: impl Into<Cow<'static, str>>, ) -> Self

Source

pub fn unknown_empty( side_effects: bool, reason: impl Into<Cow<'static, str>>, ) -> Self

Source

pub fn unknown_if( is_unknown: bool, value: JsValue, side_effects: bool, reason: impl Into<Cow<'static, str>>, ) -> Self

Source§

impl JsValue

Source

pub fn has_children(&self) -> bool

Source

pub fn total_nodes(&self) -> u32

Source

pub fn debug_assert_total_nodes_up_to_date(&mut self)

Source

pub fn ensure_node_limit(&mut self, limit: u32)

Source§

impl JsValue

Source

pub fn explain_args( args: &[JsValue], depth: usize, unknown_depth: usize, ) -> (String, String)

Source

pub fn explain(&self, depth: usize, unknown_depth: usize) -> (String, String)

Source§

impl JsValue

Source

pub fn make_unknown( &mut self, side_effects: bool, reason: impl Into<Cow<'static, str>>, )

Convert the value into unknown with a specific reason.

Source

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.

Source

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.

Source

pub fn make_nested_operations_unknown(&mut self) -> bool

Make all nested operations unknown when the value is an operation.

Source

pub fn add_unknown_mutations(&mut self, side_effects: bool)

Source§

impl JsValue

Source

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”]
Source

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.

Source

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.

Source

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

Source

pub fn as_str(&self) -> Option<&str>

Returns the constant string if the value represents a constant string.

Source

pub fn as_bool(&self) -> Option<bool>

Returns the constant bool if the value represents a constant boolean.

Source

pub fn has_side_effects(&self) -> bool

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

pub fn ends_with(&self, str: &str) -> Option<bool>

Checks if we know that the value ends with a given string. Returns None if we don’t know. Returns Some if we know if or if not the value ends with the given string.

Source§

impl JsValue

Source

pub async fn visit_async_until_settled<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
where R: 'a + Future<Output = Result<(Self, bool), E>> + Send, F: 'a + FnMut(JsValue) -> R + Send,

Visit the node and all its children with a function in a loop until the visitor returns false for the node and all children

Source

pub async fn visit_each_children_async_until_settled<'a, F, R, E>( self, visitor: &mut F, ) -> Result<Self, E>
where R: 'a + Future<Output = Result<(Self, bool), E>> + Send, F: 'a + FnMut(JsValue) -> R + Send,

Visit all children of the node with an async function in a loop until the visitor returns false

Source

pub async fn visit_async<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
where R: 'a + Future<Output = Result<(Self, bool), E>>, F: 'a + FnMut(JsValue) -> R,

Visit the node and all its children with an async function.

Source

pub async fn visit_each_children_async<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
where R: 'a + Future<Output = Result<(Self, bool), E>>, F: 'a + FnMut(JsValue) -> R,

Visit all children of the node with an async function.

Source

pub async fn for_each_children_async<'a, F, R, E>( self, visitor: &mut F, ) -> Result<(Self, bool), E>
where R: 'a + Future<Output = Result<(Self, bool), E>>, F: 'a + FnMut(JsValue) -> R,

Call an async function for each child of the node.

Source

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

Source

pub fn visit_mut( &mut self, visitor: &mut impl FnMut(&mut JsValue) -> bool, ) -> bool

Visit the node and all its children with a function.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn visit(&self, visitor: &mut impl FnMut(&JsValue))

Visit the node and all its children with a function.

Source

pub fn for_each_children(&self, visitor: &mut impl FnMut(&JsValue))

Calls a function for all children of the node.

Source§

impl JsValue

Source

pub fn normalize_shallow(&mut self)

Normalizes only the current node. Nested alternatives, concatenations, or operations are collapsed.

Source

pub fn normalize(&mut self)

Normalizes the current node and all nested nodes.

Trait Implementations§

Source§

impl Clone for JsValue

Source§

fn clone(&self) -> JsValue

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JsValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for JsValue

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for JsValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&CompileTimeDefineValue> for JsValue

Source§

fn from(v: &CompileTimeDefineValue) -> Self

Converts to this type from the input type.
Source§

impl From<&FreeVarReference> for JsValue

Source§

fn from(v: &FreeVarReference) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for JsValue

Source§

fn from(v: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Atom> for JsValue

Source§

fn from(v: Atom) -> Self

Converts to this type from the input type.
Source§

impl From<BigInt> for JsValue

Source§

fn from(v: BigInt) -> Self

Converts to this type from the input type.
Source§

impl From<Box<BigInt>> for JsValue

Source§

fn from(v: Box<BigInt>) -> Self

Converts to this type from the input type.
Source§

impl From<ConstantValue> for JsValue

Source§

fn from(v: ConstantValue) -> Self

Converts to this type from the input type.
Source§

impl From<RcStr> for JsValue

Source§

fn from(v: RcStr) -> Self

Converts to this type from the input type.
Source§

impl From<Str> for JsValue

Source§

fn from(v: Str) -> Self

Converts to this type from the input type.
Source§

impl From<String> for JsValue

Source§

fn from(v: String) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for JsValue

Source§

fn from(v: f64) -> Self

Converts to this type from the input type.
Source§

impl Hash for JsValue

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for JsValue

Source§

fn eq(&self, other: &JsValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for JsValue

Source§

impl StructuralPartialEq for JsValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn get_type_id(&self) -> TypeId

§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for T
where T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> DynamicEqHash for T
where T: Any + PartialEq + Eq + Hash,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn dyn_eq(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> ImplicitClone for T
where T: Clone,

§

fn clone_quote_var(&self) -> Self

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text italicized
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either 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,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either 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>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows 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) -> R
where R: 'a,

Mutably borrows 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
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> ToCompactString for T
where T: Display,

§

fn to_compact_string(&self) -> CompactString

Converts the given value to a [CompactString]. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<T> Upcastable for T
where T: Any + Debug + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T