swc_core::ecma::utils

Type Alias BoolValue

pub type BoolValue = Value<bool>;
Available on crate features __ecma and __utils only.

Aliased Type§

enum BoolValue {
    Known(bool),
    Unknown,
}

Variants§

§

Known(bool)

§

Unknown

Not determined at compile time.`

Implementations

§

impl<T> Value<T>

pub fn is_unknown(&self) -> bool

Returns true if the value is not known.

pub fn is_known(&self) -> bool

Returns true if the value is known.

§

impl<T> Value<T>

pub fn into_result(self) -> Result<T, UnknownError>

§

impl Value<bool>

pub fn and(self, other: Value<bool>) -> Value<bool>

pub fn or(self, other: Value<bool>) -> Value<bool>

Trait Implementations

§

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

§

fn clone(&self) -> Value<T>

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
§

impl<T> Debug for Value<T>
where T: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<T> Hash for Value<T>
where T: Hash,

§

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

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
§

impl Not for Value<bool>

§

type Output = Value<bool>

The resulting type after applying the ! operator.
§

fn not(self) -> Value<bool>

Performs the unary ! operation. Read more
§

impl<T> Ord for Value<T>
where T: Ord,

§

fn cmp(&self, other: &Value<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<T> PartialEq for Value<T>
where T: PartialEq,

§

fn eq(&self, other: &Value<T>) -> 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.
§

impl<T> PartialOrd for Value<T>
where T: PartialOrd,

§

fn partial_cmp(&self, other: &Value<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<T> Copy for Value<T>
where T: Copy,

§

impl<T> Eq for Value<T>
where T: Eq,

§

impl<T> StructuralPartialEq for Value<T>