pub enum RantValue {
    String(RantString),
    Float(f64),
    Int(i64),
    Boolean(bool),
    Function(RantFunctionHandle),
    List(RantListHandle),
    Tuple(RantTupleHandle),
    Map(RantMapHandle),
    Range(RantRange),
    Selector(RantSelectorHandle),
    Nothing,
}
Expand description

A dynamically-typed Rant value.

Cloning

Calling clone() on a by-ref Rant value type (such as list) will only clone its handle; both copies will point to the same contents.

If you want to shallow-copy a by-ref value, use the shallow_copy method instead.

Variants

String(RantString)

A Rant value of type string. Passed by-value.

Float(f64)

A Rant value of type float. Passed by-value.

Int(i64)

A Rant value of type int. Passed by-value.

Boolean(bool)

A Rant value of type bool. Passed by-value.

Function(RantFunctionHandle)

A Rant value of type function. Passed by-reference.

List(RantListHandle)

A Rant value of type list. Passed by-reference.

Tuple(RantTupleHandle)

A Rant value of type tuple. Passed by-reference.

Map(RantMapHandle)

A Rant value of type map. Passed by-reference.

Range(RantRange)

A Rant value of type range. Passed by-value.

Selector(RantSelectorHandle)

A Rant value of type selector. Passed by-value.

Nothing

A Rant unit value of type nothing. Passed by-value.

Implementations

Not a Number (NaN).

Positive infinity.

Negative infinity.

The lowest possible finite value for the float type.

The highest possible finite value for the float type.

The smallest possible float value greater than zero.

The lowest possible value for the int type.

The highest possible value for the int type.

Returns true if the value is of type nothing.

Returns true if the value is NaN (Not a Number).

Returns true if the value is callable (e.g. a function).

Interprets this value as a boolean value according to Rant’s truthiness rules.

Types are converted as follows:

  1. bool returns itself.
  2. int returns true for any non-zero value; otherwise, false.
  3. float returns true for any normal value; otherwise, false.
  4. empty returns false.
  5. Collections that can be zero-length (string, list, map, range) return true if their length is nonzero; otherwise, false.
  6. All other types return true.

Converts to a Rant bool value.

Converts to a Rant int value (or empty if the conversion fails).

Converts to a Rant float value (or empty if the conversion fails).

Converts to a Rant string value.

Converts to a Rant list value.

Converts to a Rant tuple value.

Gets the length of the value.

Returns true if the length of the value is 0.

Returns a shallow copy of the value.

Gets the Rant type associated with the value.

Gets the type name of the value.

Indicates whether the value can be indexed into.

Attempts to get a value by index.

Attempts to set a value by index.

Attempts to get a value by key.

Attempts to set a value by key.

Raises self to the exponent power.

Calculates the absolute value.

Calculates the logical AND.

Calculates the logical OR.

Calculates the logical XOR.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Gets the default RantValue (empty).

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Creates a value from an iterator. Read more

Creates a value from an iterator. Read more

Creates a value from an iterator. Read more

Converts from a RantValue.

Returns true if the type can be used to represent an optional Rant parameter in native functions; otherwise, false.

Converts to a RantValue.

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

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

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Convert from a RantValue.

Returns true if the type can be used to represent an optional Rant parameter in native functions; otherwise, false.

Attempts to convert to a RantValue.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.