# `nupp.mem.array`
Owned contiguous arrays. Views use the ordinary nupp.mem.span contracts.
## Constructors
### `array.new` _constructor_
```nupp
function array.new(takes witness: T, count: integer): array.Array
```
Allocates zeroed storage with the struct witness's physical layout.
#### Type parameters
| Name | Description |
| --- | --- |
| `T` | |
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `takes witness` | `T` | |
| `count` | `integer` | |
#### Returns
| Type | Description |
| --- | --- |
| `array.Array\` | |
## Types
### `Array` _record_
```nupp
record array.Array
readonly count: integer
read: function(borrows self: Array): span.Span borrows (self)
write: function(exclusive self: Array): span.Writable borrows (self)
end
```
#### Type parameters
| Name | Description |
| --- | --- |
| `T` | |
#### Methods
##### `read`
```nupp
read: function(borrows self: Array): span.Span borrows (self)
```
###### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `borrows self` | `Array\` | |
###### Returns
| Type | Description |
| --- | --- |
| `span.Span\ borrows (self)` | |
##### `write`
```nupp
write: function(exclusive self: Array): span.Writable borrows (self)
```
###### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `exclusive self` | `Array\` | |
###### Returns
| Type | Description |
| --- | --- |
| `span.Writable\ borrows (self)` | |
#### Fields
##### `count`
```nupp
count: integer
```
### `Bytes` _record_
```nupp
record array.Bytes
readonly count: integer
function read(borrows self): span.ByteSpan borrows (self) end
function write(exclusive self): span.Writable borrows (self) end
end
```
Owned bytes, with the same checked view vocabulary as scalar arrays.
#### Methods
##### `read`
```nupp
read: function read(borrows self): span.ByteSpan
```
###### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `borrows self` | `any` | |
###### Returns
| Type | Description |
| --- | --- |
| `span.ByteSpan` | |
##### `write`
```nupp
write: function write(exclusive self): span.Writable
```
###### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `exclusive self` | `any` | |
###### Returns
| Type | Description |
| --- | --- |
| `span.Writable\` | |
#### Fields
##### `count`
```nupp
count: integer
```
### `Scalar` _record_
```nupp
record array.Scalar
end
```
#### Type parameters
| Name | Description |
| --- | --- |
| `T` | |
## Functions
### `array.bytes` _function_
```nupp
function array.bytes(count: integer): array.Bytes
```
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
- when count is not a non-negative integer
### `array.scalar` _function_
```nupp
function array.scalar(borrows witness: array.Scalar, count: integer): array.Array
```
Allocates zeroed storage for the selected scalar element type.
#### Type parameters
| Name | Description |
| --- | --- |
| `T` | |
#### Arguments
| Name | Type | Description |
| --- | --- | --- |
| `borrows witness` | `array.Scalar\` | |
| `count` | `integer` | |
#### Returns
| Type | Description |
| --- | --- |
| `array.Array\` | |