mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-22 03:01:55 +00:00
Rename lib prefix to '~lib' (parens aren't valid); Add built-in alignof<T>; Prepare for ArrayBufferView
This commit is contained in:
15
std/assembly.d.ts
vendored
15
std/assembly.d.ts
vendored
@ -223,8 +223,10 @@ declare const NaN: f32 | f64;
|
||||
declare const Infinity: f32 | f64;
|
||||
/** Heap base offset. */
|
||||
declare const HEAP_BASE: usize;
|
||||
/** Determines the byte size of the specified core or class type. Compiles to a constant. */
|
||||
/** Determines the byte size of the specified underlying core type. Compiles to a constant. */
|
||||
declare function sizeof<T>(): usize;
|
||||
/** Determines the alignment (log2) of the specified underlying core type. Compiles to a constant. */
|
||||
declare function alignof<T>(): usize;
|
||||
/** Determines the offset of the specified field within the given class type. Returns the class type's end offset if field name has been omitted. Compiles to a constant. */
|
||||
declare function offsetof<T>(fieldName?: string): usize;
|
||||
/** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/
|
||||
@ -270,6 +272,17 @@ declare class ArrayBuffer {
|
||||
slice(begin?: i32, end?: i32): ArrayBuffer;
|
||||
}
|
||||
|
||||
/** Interface for a typed view on an array buffer. */
|
||||
declare interface ArrayBufferView<T> {
|
||||
[key: number]: T;
|
||||
/** The {@link ArrayBuffer} referenced by this view. */
|
||||
readonly buffer: ArrayBuffer;
|
||||
/** The offset in bytes from the start of the referenced {@link ArrayBuffer}. */
|
||||
readonly byteOffset: i32;
|
||||
/** The length in bytes from the start of the referenced {@link ArrayBuffer}. */
|
||||
readonly byteLength: i32;
|
||||
}
|
||||
|
||||
/** Class representing a sequence of values of type `T`. */
|
||||
declare class Array<T> {
|
||||
[key: number]: T;
|
||||
|
Reference in New Issue
Block a user