Enum hcl::eval::ParamType

source ·
pub enum ParamType {
    Any,
    Bool,
    Number,
    String,
    Array(Box<ParamType>),
    Object(Box<ParamType>),
    OneOf(Vec<ParamType>),
    Nullable(Box<ParamType>),
}
Expand description

A type hint for a function parameter.

The parameter type is used to validate the arguments of a function call expression before evaluating the function.

See the documentation of FuncDef for usage examples.

Variants§

§

Any

Any type is allowed.

§

Bool

The parameter must be a boolean value.

§

Number

The parameter must be a number.

§

String

The parameter must be a string value.

§

Array(Box<ParamType>)

The parameter must be an array which must contain only elements of the given element type.

§

Object(Box<ParamType>)

The parameter must be an object which must contain only entries with values of the given element type. The object key type is always a string.

§

OneOf(Vec<ParamType>)

The parameter can be one of the provided types. If the Vec is empty, any type is allowed.

§

Nullable(Box<ParamType>)

The parameter must be either null or of the provided type.

Implementations§

Creates a new Array parameter type with the given element type.

Creates a new Object parameter type with the given element type.

The object key type is always a string and thus not specified here.

Creates a new OneOf parameter type from the provided alternatives.

Creates a new Nullable parameter type from a non-null parameter type.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

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

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