Expression

Enum Expression 

Source
#[repr(C, u8)]
pub enum Expression<'a> {
Show 43 variants BooleanLiteral(Box<'a, BooleanLiteral>), NullLiteral(Box<'a, NullLiteral>), NumericLiteral(Box<'a, NumericLiteral<'a>>), BigIntLiteral(Box<'a, BigIntLiteral<'a>>), RegExpLiteral(Box<'a, RegExpLiteral<'a>>), StringLiteral(Box<'a, StringLiteral<'a>>), TemplateLiteral(Box<'a, TemplateLiteral<'a>>), Identifier(Box<'a, IdentifierReference<'a>>), MetaProperty(Box<'a, MetaProperty<'a>>), Super(Box<'a, Super>), ArrayExpression(Box<'a, ArrayExpression<'a>>), ArrowFunctionExpression(Box<'a, ArrowFunctionExpression<'a>>), AssignmentExpression(Box<'a, AssignmentExpression<'a>>), AwaitExpression(Box<'a, AwaitExpression<'a>>), BinaryExpression(Box<'a, BinaryExpression<'a>>), CallExpression(Box<'a, CallExpression<'a>>), ChainExpression(Box<'a, ChainExpression<'a>>), ClassExpression(Box<'a, Class<'a>>), ConditionalExpression(Box<'a, ConditionalExpression<'a>>), FunctionExpression(Box<'a, Function<'a>>), ImportExpression(Box<'a, ImportExpression<'a>>), LogicalExpression(Box<'a, LogicalExpression<'a>>), NewExpression(Box<'a, NewExpression<'a>>), ObjectExpression(Box<'a, ObjectExpression<'a>>), ParenthesizedExpression(Box<'a, ParenthesizedExpression<'a>>), SequenceExpression(Box<'a, SequenceExpression<'a>>), TaggedTemplateExpression(Box<'a, TaggedTemplateExpression<'a>>), ThisExpression(Box<'a, ThisExpression>), UnaryExpression(Box<'a, UnaryExpression<'a>>), UpdateExpression(Box<'a, UpdateExpression<'a>>), YieldExpression(Box<'a, YieldExpression<'a>>), PrivateInExpression(Box<'a, PrivateInExpression<'a>>), JSXElement(Box<'a, JSXElement<'a>>), JSXFragment(Box<'a, JSXFragment<'a>>), TSAsExpression(Box<'a, TSAsExpression<'a>>), TSSatisfiesExpression(Box<'a, TSSatisfiesExpression<'a>>), TSTypeAssertion(Box<'a, TSTypeAssertion<'a>>), TSNonNullExpression(Box<'a, TSNonNullExpression<'a>>), TSInstantiationExpression(Box<'a, TSInstantiationExpression<'a>>), V8IntrinsicExpression(Box<'a, V8IntrinsicExpression<'a>>), ComputedMemberExpression(Box<'a, ComputedMemberExpression<'a>>), StaticMemberExpression(Box<'a, StaticMemberExpression<'a>>), PrivateFieldExpression(Box<'a, PrivateFieldExpression<'a>>),
}
Expand description

Represents a type for AST nodes corresponding to JavaScript’s expressions.

Inherits variants from MemberExpression. See ast module docs for explanation of inheritance.

Variants§

§

BooleanLiteral(Box<'a, BooleanLiteral>)

See BooleanLiteral for AST node details.

§

NullLiteral(Box<'a, NullLiteral>)

See NullLiteral for AST node details.

§

NumericLiteral(Box<'a, NumericLiteral<'a>>)

See NumericLiteral for AST node details.

§

BigIntLiteral(Box<'a, BigIntLiteral<'a>>)

See BigIntLiteral for AST node details.

§

RegExpLiteral(Box<'a, RegExpLiteral<'a>>)

See RegExpLiteral for AST node details.

§

StringLiteral(Box<'a, StringLiteral<'a>>)

See StringLiteral for AST node details.

§

TemplateLiteral(Box<'a, TemplateLiteral<'a>>)

See TemplateLiteral for AST node details.

§

Identifier(Box<'a, IdentifierReference<'a>>)

See IdentifierReference for AST node details.

§

MetaProperty(Box<'a, MetaProperty<'a>>)

See MetaProperty for AST node details.

§

Super(Box<'a, Super>)

See Super for AST node details.

§

ArrayExpression(Box<'a, ArrayExpression<'a>>)

See ArrayExpression for AST node details.

§

ArrowFunctionExpression(Box<'a, ArrowFunctionExpression<'a>>)

See ArrowFunctionExpression for AST node details.

§

AssignmentExpression(Box<'a, AssignmentExpression<'a>>)

See AssignmentExpression for AST node details.

§

AwaitExpression(Box<'a, AwaitExpression<'a>>)

See AwaitExpression for AST node details.

§

BinaryExpression(Box<'a, BinaryExpression<'a>>)

See BinaryExpression for AST node details.

§

CallExpression(Box<'a, CallExpression<'a>>)

See CallExpression for AST node details.

§

ChainExpression(Box<'a, ChainExpression<'a>>)

See ChainExpression for AST node details.

§

ClassExpression(Box<'a, Class<'a>>)

See Class for AST node details.

§

ConditionalExpression(Box<'a, ConditionalExpression<'a>>)

See ConditionalExpression for AST node details.

§

FunctionExpression(Box<'a, Function<'a>>)

See Function for AST node details.

§

ImportExpression(Box<'a, ImportExpression<'a>>)

See ImportExpression for AST node details.

§

LogicalExpression(Box<'a, LogicalExpression<'a>>)

See LogicalExpression for AST node details.

§

NewExpression(Box<'a, NewExpression<'a>>)

See NewExpression for AST node details.

§

ObjectExpression(Box<'a, ObjectExpression<'a>>)

See ObjectExpression for AST node details.

§

ParenthesizedExpression(Box<'a, ParenthesizedExpression<'a>>)

See ParenthesizedExpression for AST node details.

§

SequenceExpression(Box<'a, SequenceExpression<'a>>)

See SequenceExpression for AST node details.

§

TaggedTemplateExpression(Box<'a, TaggedTemplateExpression<'a>>)

See TaggedTemplateExpression for AST node details.

§

ThisExpression(Box<'a, ThisExpression>)

See ThisExpression for AST node details.

§

UnaryExpression(Box<'a, UnaryExpression<'a>>)

See UnaryExpression for AST node details.

§

UpdateExpression(Box<'a, UpdateExpression<'a>>)

See UpdateExpression for AST node details.

§

YieldExpression(Box<'a, YieldExpression<'a>>)

See YieldExpression for AST node details.

§

PrivateInExpression(Box<'a, PrivateInExpression<'a>>)

See PrivateInExpression for AST node details.

§

JSXElement(Box<'a, JSXElement<'a>>)

See JSXElement for AST node details.

§

JSXFragment(Box<'a, JSXFragment<'a>>)

See JSXFragment for AST node details.

§

TSAsExpression(Box<'a, TSAsExpression<'a>>)

See TSAsExpression for AST node details.

§

TSSatisfiesExpression(Box<'a, TSSatisfiesExpression<'a>>)

See TSSatisfiesExpression for AST node details.

§

TSTypeAssertion(Box<'a, TSTypeAssertion<'a>>)

See TSTypeAssertion for AST node details.

§

TSNonNullExpression(Box<'a, TSNonNullExpression<'a>>)

See TSNonNullExpression for AST node details.

§

TSInstantiationExpression(Box<'a, TSInstantiationExpression<'a>>)

See TSInstantiationExpression for AST node details.

§

V8IntrinsicExpression(Box<'a, V8IntrinsicExpression<'a>>)

See V8IntrinsicExpression for AST node details.

§

ComputedMemberExpression(Box<'a, ComputedMemberExpression<'a>>)

Inherited from MemberExpression.

MemberExpression[?Yield, ?Await] [ Expression[+In, ?Yield, ?Await] ]

§

StaticMemberExpression(Box<'a, StaticMemberExpression<'a>>)

Inherited from MemberExpression.

MemberExpression[?Yield, ?Await] . IdentifierName

§

PrivateFieldExpression(Box<'a, PrivateFieldExpression<'a>>)

Inherited from MemberExpression.

MemberExpression[?Yield, ?Await] . PrivateIdentifier

Implementations§

Source§

impl<'a> Expression<'a>

Source

pub fn is_member_expression(&self) -> bool

Return if a Expression is a MemberExpression.

Source

pub fn into_member_expression(self) -> MemberExpression<'a>

Convert Expression to MemberExpression.

§Panic

Panics if not convertible.

Source

pub fn as_member_expression(&self) -> Option<&MemberExpression<'a>>

Convert &Expression to &MemberExpression.

Source

pub fn as_member_expression_mut(&mut self) -> Option<&mut MemberExpression<'a>>

Convert &mut Expression to &mut MemberExpression.

Source

pub fn to_member_expression(&self) -> &MemberExpression<'a>

Convert &Expression to &MemberExpression.

§Panic

Panics if not convertible.

Source

pub fn to_member_expression_mut(&mut self) -> &mut MemberExpression<'a>

Convert &mut Expression to &mut MemberExpression.

§Panic

Panics if not convertible.

Source§

impl<'a> Expression<'a>

Source

pub fn is_typescript_syntax(&self) -> bool

Returns true if this expression is TypeScript-specific syntax.

Source

pub fn is_primary_expression(&self) -> bool

Returns true if this is a primary expression.

Source

pub fn is_literal(&self) -> bool

true if this Expression is a literal expression for a primitive value.

Does not include TemplateLiterals, object literals, or array literals.

Source

pub fn is_string_literal(&self) -> bool

Returns true for string and template literals.

Source

pub fn is_no_substitution_template(&self) -> bool

Return true if the expression is a plain template.

Source

pub fn is_number_literal(&self) -> bool

Returns true for numeric and big int literals.

Source

pub fn is_big_int_literal(&self) -> bool

Returns true for bigint literals.

Source

pub fn is_specific_string_literal(&self, string: &str) -> bool

Returns true for string literals matching the expected value. Note that non-substitution template literals are not considered.

Source

pub fn is_null(&self) -> bool

Determines whether the given expr is a null literal

Source

pub fn is_undefined(&self) -> bool

Determines whether the given expr is a undefined literal

Source

pub fn is_void(&self) -> bool

Determines whether the given expr is a void expr

Source

pub fn is_void_0(&self) -> bool

Determines whether the given expr is a void 0

Source

pub fn is_number(&self) -> bool

Returns true for numeric literals

Source

pub fn is_number_0(&self) -> bool

Determines whether the given expr is a 0

Source

pub fn is_number_value(&self, val: f64) -> bool

Determines whether the given expr is a specific number literal.

Source

pub fn is_specific_raw_number_literal(&self, val: &str) -> bool

Determines whether the given numeral literal’s raw value is exactly val

Source

pub fn evaluate_to_undefined(&self) -> bool

Determines whether the given expr evaluate to undefined

Source

pub fn is_null_or_undefined(&self) -> bool

Determines whether the given expr is a null or undefined or void 0

Corresponds to a nullish value check.

Source

pub fn is_nan(&self) -> bool

Determines whether the given expr is a NaN literal

Source

pub fn without_parentheses(&self) -> &Expression<'a>

Remove nested parentheses from this expression.

Source

pub fn without_parentheses_mut(&mut self) -> &mut Expression<'a>

Remove nested parentheses from this expression.

Source

pub fn is_specific_id(&self, name: &str) -> bool

Returns true if this Expression is an IdentifierReference with specified name.

Source

pub fn is_specific_member_access(&self, object: &str, property: &str) -> bool

Returns true if this Expression is a MemberExpression with the specified object name and property name.

For example, Array.from is a specific member access with object Array and property from and could be checked like expr.is_specific_member_access("Array", "from").

Source

pub fn into_inner_expression(self) -> Expression<'a>

Returns the expression inside of this one, if applicable, and takes ownership of it. For example, if the expression is a ParenthesizedExpression, it will return the expression inside the parentheses. Or if this is part of a TypeScript expression like as, satisfies, or !, then it will return the expression that is being type asserted.

For getting a reference to the expression inside, use Expression::get_inner_expression.

Source

pub fn get_inner_expression(&self) -> &Expression<'a>

Gets the expression inside of this one, if applicable, and returns a reference to it. For example, if the expression is a ParenthesizedExpression, it will return the expression inside the parentheses. Or if this is part of a TypeScript expression like as, satisfies, or !, then it will return the expression that is being type asserted.

For taking ownership of the expression inside, use Expression::into_inner_expression. For getting a mutable reference to the expression inside, use Expression::get_inner_expression_mut.

Source

pub fn get_inner_expression_mut(&mut self) -> &mut Expression<'a>

Gets the expression inside of this one, if applicable, and returns a mutable reference to it. For example, if the expression is a ParenthesizedExpression, it will return the expression inside the parentheses. Or if this is part of a TypeScript expression like as, satisfies, or !, then it will return the expression that is being type asserted.

For taking ownership of the expression inside, use Expression::into_inner_expression. For getting an immutable reference to the expression inside, use Expression::get_inner_expression.

Source

pub fn into_chain_element(self) -> Option<ChainElement<'a>>

Turns any chainable expression such as a.b or b() into the chained equivalent such as a?.b or b?.().

Source

pub fn is_identifier_reference(&self) -> bool

Returns true if this Expression is an IdentifierReference.

Source

pub fn get_identifier_reference(&self) -> Option<&IdentifierReference<'a>>

Returns the IdentifierReference if this expression is an Expression::Identifier, or contains an Expression::Identifier and reruns None otherwise.

Source

pub fn is_function(&self) -> bool

Returns true if this Expression is a function (either Function or ArrowFunctionExpression).

Source

pub fn is_anonymous_function_definition(&self) -> bool

Returns true if this Expression is an anonymous function definition. Note that this includes Classs. https://262.ecma-international.org/15.0/#sec-isanonymousfunctiondefinition

Source

pub fn is_call_expression(&self) -> bool

Returns true if this Expression is a CallExpression.

Source

pub fn is_super(&self) -> bool

Returns true if this Expression is a Super.

Source

pub fn is_super_call_expression(&self) -> bool

Returns true if this Expression is a CallExpression with Super as callee.

Source

pub fn is_call_like_expression(&self) -> bool

Returns true if this Expression is a CallExpression, NewExpression, or ImportExpression.

Source

pub fn is_binaryish(&self) -> bool

Returns true if this Expression is a BinaryExpression or LogicalExpression.

Source

pub fn get_member_expr(&self) -> Option<&MemberExpression<'a>>

Returns the MemberExpression if this expression is a MemberExpression, contains a MemberExpression, or is or part of a ChainExpression (such as a?.b), and returns None otherwise if this is not a member expression.

Source

pub fn is_require_call(&self) -> bool

Returns true if this Expression is a require call.

See CallExpression::is_require_call for details of the exact patterns that match.

Source

pub fn is_assignment(&self) -> bool

Returns true if this is an assignment expression.

Source

pub fn is_entity_name_expression(&self) -> bool

Is identifier or a.b expression where a is an identifier.

Source

pub fn is_property_access_entity_name_expression(&self) -> bool

a.b expression where a is an identifier.

Source

pub fn is_jsx(&self) -> bool

Returns true if this Expression is a JSXElement or JSXFragment.

Trait Implementations§

Source§

impl<'new_alloc> CloneIn<'new_alloc> for Expression<'_>

Source§

type Cloned = Expression<'new_alloc>

The type of the cloned object. Read more
Source§

fn clone_in( &self, allocator: &'new_alloc Allocator, ) -> <Expression<'_> as CloneIn<'new_alloc>>::Cloned

Clone self into the given allocator. allocator may be the same one that self is already in.
Source§

fn clone_in_with_semantic_ids( &self, allocator: &'new_alloc Allocator, ) -> <Expression<'_> as CloneIn<'new_alloc>>::Cloned

Almost identical as clone_in, but for some special type, it will also clone the semantic ids. Please use this method only if you make sure semantic info is synced with the ast node.
Source§

impl<'a> ConstantEvaluation<'a> for Expression<'a>

Source§

fn evaluate_value_to( &self, ctx: &impl ConstantEvaluationCtx<'a>, target_ty: Option<ValueType>, ) -> Option<ConstantValue<'a>>

Evaluate the expression to a constant value. Read more
Source§

fn evaluate_value( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<ConstantValue<'a>>

Evaluate the expression to a constant value. Read more
Source§

fn evaluate_value_to_number( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<f64>

Evaluate the expression to a constant value and convert it to a number.
Source§

fn evaluate_value_to_bigint( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<BigInt>

Evaluate the expression to a constant value and convert it to a bigint.
Source§

fn evaluate_value_to_boolean( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<bool>

Evaluate the expression to a constant value and convert it to a boolean.
Source§

fn evaluate_value_to_string( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<Cow<'a, str>>

Evaluate the expression to a constant value and convert it to a string.
Source§

fn get_side_free_number_value( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<f64>

Source§

fn get_side_free_bigint_value( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<BigInt>

Source§

fn get_side_free_boolean_value( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<bool>

Source§

fn get_side_free_string_value( &self, ctx: &impl ConstantEvaluationCtx<'a>, ) -> Option<Cow<'a, str>>

Source§

impl ContentEq for Expression<'_>

Source§

fn content_eq(&self, other: &Expression<'_>) -> bool

This method tests for contents of self and other to be equal.
Source§

fn content_ne(&self, other: &Self) -> bool

This method tests for contents of self and other not to be equal. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Debug for Expression<'a>

Source§

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

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

impl<'a> DetermineValueType<'a> for Expression<'a>

Source§

fn value_type(&self, ctx: &impl GlobalContext<'a>) -> ValueType

Source§

impl<'a> Dummy<'a> for Expression<'a>

Source§

fn dummy(allocator: &'a Allocator) -> Expression<'a>

Create a dummy Expression.

Has cost of making 1 allocation (8 bytes).

Source§

impl<'a> From<ChainElement<'a>> for Expression<'a>

Source§

fn from(value: ChainElement<'a>) -> Expression<'a>

Converts to this type from the input type.
Source§

impl<'a> From<Expression<'a>> for Argument<'a>

Source§

fn from(value: Expression<'a>) -> Argument<'a>

Convert Expression to Argument.

Source§

impl<'a> From<Expression<'a>> for ArrayExpressionElement<'a>

Source§

fn from(value: Expression<'a>) -> ArrayExpressionElement<'a>

Convert Expression to ArrayExpressionElement.

Source§

impl<'a> From<Expression<'a>> for ExportDefaultDeclarationKind<'a>

Source§

fn from(value: Expression<'a>) -> ExportDefaultDeclarationKind<'a>

Convert Expression to ExportDefaultDeclarationKind.

Source§

impl<'a> From<Expression<'a>> for ForStatementInit<'a>

Source§

fn from(value: Expression<'a>) -> ForStatementInit<'a>

Convert Expression to ForStatementInit.

Source§

impl<'a> From<Expression<'a>> for JSXExpression<'a>

Source§

fn from(value: Expression<'a>) -> JSXExpression<'a>

Convert Expression to JSXExpression.

Source§

impl<'a> From<Expression<'a>> for PropertyKey<'a>

Source§

fn from(value: Expression<'a>) -> PropertyKey<'a>

Convert Expression to PropertyKey.

Source§

impl<'a> From<MemberExpression<'a>> for Expression<'a>

Source§

fn from(value: MemberExpression<'a>) -> Expression<'a>

Convert MemberExpression to Expression.

Source§

impl<'a> GatherNodeParts<'a> for Expression<'a>

Source§

fn gather<F>(&self, f: &mut F)
where F: FnMut(&str),

Source§

impl GenExpr for Expression<'_>

Source§

fn gen_expr(&self, p: &mut Codegen<'_>, precedence: Precedence, ctx: Context)

Generate code for an expression, respecting operator precedence.
Source§

fn print_expr(&self, p: &mut Codegen<'_>, precedence: Precedence, ctx: Context)

Generate code for an expression, respecting operator precedence. Alias for gen_expr.
Source§

impl GetAddress for Expression<'_>

Source§

fn address(&self) -> Address

Get the memory address of a value allocated in the arena.
Source§

impl GetPrecedence for Expression<'_>

Source§

impl GetSpan for Expression<'_>

Source§

fn span(&self) -> Span

Get the Span for an AST node.
Source§

impl GetSpanMut for Expression<'_>

Source§

fn span_mut(&mut self) -> &mut Span

Get a mutable reference to an AST node’s Span.
Source§

impl IsGlobalReference for Expression<'_>

Source§

fn is_global_reference(&self, scoping: &Scoping) -> bool

Source§

fn is_global_reference_name(&self, name: &str, scoping: &Scoping) -> bool

Source§

impl<'a> IsInt32OrUint32<'a> for Expression<'a>

Source§

fn is_int32_or_uint32(&self, ctx: &impl GlobalContext<'a>) -> bool

Whether the value of the expression is a int32 or uint32. If this method returns true, we know that the value cannot be NaN or Infinity. Read more
Source§

impl<'a> IsLiteralValue<'a, '_> for Expression<'a>

Source§

fn is_literal_value( &self, include_functions: bool, ctx: &impl GlobalContext<'a>, ) -> bool

Source§

impl<'a> MayHaveSideEffects<'a> for Expression<'a>

Source§

impl<'a> TakeIn<'a> for Expression<'a>

Source§

fn take_in<A>(&mut self, allocator_accessor: A) -> Self
where A: AllocatorAccessor<'a>,

Replace node with a dummy.
Source§

fn take_in_box<A>(&mut self, allocator_accessor: A) -> Box<'a, Self>
where A: AllocatorAccessor<'a>,

Replace node with a boxed dummy.
Source§

impl<'a> ToBigInt<'a> for Expression<'a>

Source§

fn to_big_int(&self, ctx: &impl GlobalContext<'a>) -> Option<BigInt>

Source§

impl<'a> ToBoolean<'a> for Expression<'a>

Source§

fn to_boolean(&self, ctx: &impl GlobalContext<'a>) -> Option<bool>

Source§

impl<'a> ToJsString<'a> for Expression<'a>

Source§

fn to_js_string(&self, ctx: &impl GlobalContext<'a>) -> Option<Cow<'a, str>>

Source§

impl<'a> ToNumber<'a> for Expression<'a>

Source§

fn to_number(&self, ctx: &impl GlobalContext<'a>) -> Option<f64>

Source§

impl<'a> ToPrimitive<'a> for Expression<'a>

Source§

fn to_primitive(&self, ctx: &impl GlobalContext<'a>) -> ToPrimitiveResult

Source§

impl<'a> TryFrom<Argument<'a>> for Expression<'a>

Source§

fn try_from( value: Argument<'a>, ) -> Result<Expression<'a>, <Expression<'a> as TryFrom<Argument<'a>>>::Error>

Convert Argument to Expression.

Source§

type Error = ()

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

impl<'a> TryFrom<ArrayExpressionElement<'a>> for Expression<'a>

Source§

fn try_from( value: ArrayExpressionElement<'a>, ) -> Result<Expression<'a>, <Expression<'a> as TryFrom<ArrayExpressionElement<'a>>>::Error>

Convert ArrayExpressionElement to Expression.

Source§

type Error = ()

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

impl<'a> TryFrom<ExportDefaultDeclarationKind<'a>> for Expression<'a>

Source§

fn try_from( value: ExportDefaultDeclarationKind<'a>, ) -> Result<Expression<'a>, <Expression<'a> as TryFrom<ExportDefaultDeclarationKind<'a>>>::Error>

Convert ExportDefaultDeclarationKind to Expression.

Source§

type Error = ()

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

impl<'a> TryFrom<Expression<'a>> for MemberExpression<'a>

Source§

fn try_from( value: Expression<'a>, ) -> Result<MemberExpression<'a>, <MemberExpression<'a> as TryFrom<Expression<'a>>>::Error>

Convert Expression to MemberExpression.

Source§

type Error = ()

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

impl<'a> TryFrom<ForStatementInit<'a>> for Expression<'a>

Source§

fn try_from( value: ForStatementInit<'a>, ) -> Result<Expression<'a>, <Expression<'a> as TryFrom<ForStatementInit<'a>>>::Error>

Convert ForStatementInit to Expression.

Source§

type Error = ()

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

impl<'a> TryFrom<JSXExpression<'a>> for Expression<'a>

Source§

fn try_from( value: JSXExpression<'a>, ) -> Result<Expression<'a>, <Expression<'a> as TryFrom<JSXExpression<'a>>>::Error>

Convert JSXExpression to Expression.

Source§

type Error = ()

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

impl<'a> TryFrom<PropertyKey<'a>> for Expression<'a>

Source§

fn try_from( value: PropertyKey<'a>, ) -> Result<Expression<'a>, <Expression<'a> as TryFrom<PropertyKey<'a>>>::Error>

Convert PropertyKey to Expression.

Source§

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl<'a> Freeze for Expression<'a>

§

impl<'a> !RefUnwindSafe for Expression<'a>

§

impl<'a> !Send for Expression<'a>

§

impl<'a> !Sync for Expression<'a>

§

impl<'a> Unpin for Expression<'a>

§

impl<'a> !UnwindSafe for Expression<'a>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
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
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<D> OwoColorize for D

Source§

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

Set the foreground color generically Read more
Source§

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

Set the background color generically. Read more
Source§

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

Change the foreground color to black
Source§

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

Change the background color to black
Source§

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

Change the foreground color to red
Source§

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

Change the background color to red
Source§

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

Change the foreground color to green
Source§

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

Change the background color to green
Source§

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

Change the foreground color to yellow
Source§

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

Change the background color to yellow
Source§

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

Change the foreground color to blue
Source§

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

Change the background color to blue
Source§

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

Change the foreground color to magenta
Source§

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

Change the background color to magenta
Source§

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

Change the foreground color to purple
Source§

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

Change the background color to purple
Source§

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

Change the foreground color to cyan
Source§

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

Change the background color to cyan
Source§

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

Change the foreground color to white
Source§

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

Change the background color to white
Source§

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

Change the foreground color to the terminal default
Source§

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

Change the background color to the terminal default
Source§

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

Change the foreground color to bright black
Source§

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

Change the background color to bright black
Source§

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

Change the foreground color to bright red
Source§

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

Change the background color to bright red
Source§

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

Change the foreground color to bright green
Source§

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

Change the background color to bright green
Source§

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

Change the foreground color to bright yellow
Source§

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

Change the background color to bright yellow
Source§

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

Change the foreground color to bright blue
Source§

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

Change the background color to bright blue
Source§

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

Change the foreground color to bright magenta
Source§

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

Change the background color to bright magenta
Source§

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

Change the foreground color to bright purple
Source§

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

Change the background color to bright purple
Source§

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

Change the foreground color to bright cyan
Source§

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

Change the background color to bright cyan
Source§

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

Change the foreground color to bright white
Source§

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

Change the background color to bright white
Source§

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

Make the text bold
Source§

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

Make the text dim
Source§

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

Make the text italicized
Source§

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

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

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

Swap the foreground and background colors
Source§

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

Hide the text
Source§

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

Cross out the text
Source§

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

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

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

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

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

Sets the foreground color to an RGB value.
Source§

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

Sets the background color to an RGB value.
Source§

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

Apply a runtime-determined style
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.