Details
Important: This implementation assumes little-endianness.
Members
Type Aliases
typealias Header = (count: Int, capacity: Int)
The description of out-of-line payloads in UTF8Arrays.
Functions
static fun init_on_head(_ self: set Self, unsafely_copying source: PointerToBuffer<Int8>, reserving minimum_capacity: Int)
Initializes self to an instance with the contents of source copied to out-of-line storage capable of holding at least minimum_capacity units.
fun is_empty() -> Bool
Returns true if self is empty.
fun capacity() -> Int
The number of elements that can be stored in the array before new storage must be allocated.
fun reserve_capacity(_ n: Int) { inout }
Reserves enough space to store n elements in self.
fun is_inline() -> Bool
Returns true if the payload of self is stored inline.
fun is_unowned() -> Bool
Returns true if self does not own its payload.
fun requires_head_deallocation() -> Bool
Returns true if the payload of self is out-of-line and owned.
fun unsafe_heap_header() -> Pointer<Header>
Returns a pointer to the header of the out-of-line storage, assuming it exists.
Subscripts
property nullterminated: Pointer<Int8> { let }
Projects the units in self as a null-terminated buffer.
Initializers
init()
Creates an instance with given representation.
init(taking_ownership_of p: MemoryAddress)
Creates a view taking ownership of the out-of-line payload referred by p.
init()
Creates an empty view.
init(unsafely_copying source: PointerToBuffer<Int8>, reserving minimum_capacity: Int)
Creates an instance with the contents of source copied to a buffer capable of holding at least minimum_capacity units.