( buffer: ArrayBuffer, options?: FromOptions, )
| 74 | } |
| 75 | |
| 76 | export const from = ( |
| 77 | buffer: ArrayBuffer, |
| 78 | options?: FromOptions, |
| 79 | ): MutableBytes => |
| 80 | createProto( |
| 81 | MutableBytesProto, |
| 82 | { |
| 83 | initialCapacity: buffer.byteLength, |
| 84 | growthStrategy: options?.growthStrategy ?? "doubling", |
| 85 | }, |
| 86 | { |
| 87 | length: buffer.byteLength, |
| 88 | inner: buffer, |
| 89 | }, |
| 90 | ) satisfies MutableBytesImpl as MutableBytes; |
| 91 | |
| 92 | export const capacity = (self: MutableBytes) => |
| 93 | (self as MutableBytesImpl).inner.byteLength; |