Lyricdev
GitHub

interface FromArrayLiteral

pub interface FromArrayLiteral<T>

Builds a value of the type from an array literal where one is expected.

The elements check against T, and the literal becomes Self.fromLiteral([…]): let s: Set<int> = [1, 2, 3];, let m: Map<string, int> = [("a", 1)]; (a map has no literal of its own). The result is a copy, as of would make one.

Methods

static fn fromLiteral(items: T[]): Self