struct Storage<Element>Properties
let base: RawPtr
The base address of the storage allocation.
Methods
func get(_ index: Int) -> &Element
Borrows the initialized element at index; bounds are the caller's responsibility.
View Source
pub func get(_ index: Int) -> &Element {
let ptr: RawPtr = #_ir(self.base, index) { %? = gep Element $0 $1 }
_load<Element>(ptr: ptr)
}func set(index: Int, consume value: Element) -> Void
Stores value at index; the slot's initialization state is the caller's responsibility.
View Source
pub func set(index: Int, consume value: Element) -> Void {
let ptr: RawPtr = #_ir(self.base, index) { %? = gep Element $0 $1 }
_store<Element>(ptr: ptr, value: value)
}