nupp.mem.array
Owned contiguous arrays. Views use the ordinary nupp.mem.span contracts.
Module contents
Constructors
| Constructor | Description |
|---|
new | Allocates zeroed storage with the struct witness's physical layout. |
Types
| Type | Kind | Description |
|---|
Array | record | |
Bytes | record | Owned bytes, with the same checked view vocabulary as scalar arrays. |
Scalar | record | |
Functions
| Function | Kind | Description |
|---|
bytes | function | Allocates zeroed bytes without treating the storage-only uint8 as a value type. |
scalar | function | Allocates zeroed storage for the selected scalar element type. |
Constructors
array.newconstructor
function array.new<T>(takes witness: T, count: integer): array.Array<T>
Allocates zeroed storage with the struct witness's physical layout.
Type parameters
Arguments
| Name | Type | Description |
|---|
takes witness | T | |
count | integer | |
Returns
| Type | Description |
|---|
array.Array<T> | |
Types
Arrayrecord
record array.Array<T>
readonly count: integer
read: function(borrows self: Array<T>): span.Span<T> borrows (self)
write: function(exclusive self: Array<T>): span.Writable<T> borrows (self)
end
Type parameters
Methods
read
read: function(borrows self: Array<T>): span.Span<T> borrows (self)
Arguments
| Name | Type | Description |
|---|
borrows self | Array<T> | |
Returns
| Type | Description |
|---|
span.Span<T> borrows (self) | |
write
write: function(exclusive self: Array<T>): span.Writable<T> borrows (self)
Arguments
| Name | Type | Description |
|---|
exclusive self | Array<T> | |
Returns
| Type | Description |
|---|
span.Writable<T> borrows (self) | |
Fields
Bytesrecord
record array.Bytes
readonly count: integer
function read(borrows self): span.ByteSpan borrows (self) end
function write(exclusive self): span.Writable<uint8> borrows (self) end
end
Owned bytes, with the same checked view vocabulary as scalar arrays.
Methods
read
Arguments
| Name | Type | Description |
|---|
borrows self | any | |
Returns
write
write: function write(exclusive self): span.Writable<uint8>
Arguments
| Name | Type | Description |
|---|
exclusive self | any | |
Returns
| Type | Description |
|---|
span.Writable<uint8> | |
Fields
Scalarrecord
Type parameters
Functions
array.bytesfunction
Allocates zeroed bytes without treating the storage-only uint8 as a value type.
Arguments
| Name | Type | Description |
|---|
count | integer | |
Returns
| Type | Description |
|---|
array.Bytes | |
Raises
array.scalarfunction
Allocates zeroed storage for the selected scalar element type.
Type parameters
Arguments
| Name | Type | Description |
|---|
borrows witness | array.Scalar<T> | |
count | integer | |
Returns
| Type | Description |
|---|
array.Array<T> | |