ByteStorage

struct ByteStorage

A reference-counted raw byte allocation used by UTF-8 and encoded tables.

Like Storage, it carries no length or capacity. Owners such as String track those bounds separately; callers of get and set must stay within the allocation.

Properties

let base: RawPtr

The base address of the storage allocation.

Methods

func get(_ index: Int) -> Byte

Loads the byte at index; bounds are the caller's responsibility.

View Source
pub func get(_ index: Int) -> Byte {
	let ptr: RawPtr = #_ir(self.base, index) { %? = gep Byte $0 $1 }
	_load<Byte>(ptr: ptr)
}

func set(index: Int, value: Byte) -> Void

Stores value in the byte slot at index.

View Source
pub func set(index: Int, value: Byte) -> Void {
	let ptr: RawPtr = #_ir(self.base, index) { %? = gep Byte $0 $1 }
	_store<Byte>(ptr: ptr, value: value)
}