InlineArray

struct InlineArray<Element, static Count: Int>

An exact-size aggregate. Its elements are stored directly in the value; Count is part of the type and is not stored at runtime.

Methods

func count() -> Int

Returns the compile-time element count carried by this type.

View Source
pub func count() -> Int { Count }

func get(_ index: Int) -> Optional<&Element>

Borrows an element when index is within 0..<Count.

View Source
pub func get(_ index: Int) -> Optional<&Element> {
	if index < 0 { return .none }
	if Count <= index { return .none }
	.some(#_ir(index) { %? = inline_get Element %0 $0 })
}