A special type that represents a "rest" function argument.

The special ... syntax can be used for convenience and improved readability:

function f(...rest:Int) {
	$type(rest); // haxe.Rest<Int>
}

f(1, 2, 3);

final array = [1, 2, 3];
f(...array);

Should be used as a type for the last argument of a method, indicating that an arbitrary number of arguments of the given type can be passed to that method.

Allows to use array access by index to get values of rest arguments. If the index exceeds the amount of rest arguments passed, the result is unspecified.

Static variables

staticread onlylength:Int

Amount of arguments passed as rest arguments

Static methods

staticappend(this:NativeRest<T>, item:T):Rest<T>

Create a new rest arguments collection by appending item to this one.

staticinlineiterator(this:NativeRest<T>):RestIterator<T>

staticinlinekeyValueIterator(this:NativeRest<T>):RestKeyValueIterator<T>

@:fromstaticof<T>(array:Array<T>):Rest<T>

Create rest arguments using contents of array.

WARNING: Depending on a target platform modifying array after using this method may affect the created Rest instance. Use Rest.of(array.copy()) to avoid that.

staticprepend(this:NativeRest<T>, item:T):Rest<T>

Create a new rest arguments collection by prepending this one with item.

@:tostatictoArray(this:NativeRest<T>):Array<T>

Creates an array containing all the values of rest arguments.

statictoString(this:NativeRest<T>):String