node-ctypes - v2.10.0
    Preparing search index...

    Interface UnionDef<F>

    A union type definition created by the union function.

    All fields share the same memory region. The total size equals the size of the largest field.

    interface UnionDef<F extends Record<string, FieldSpec> = Record<string, any>> {
        size: number;
        alignment: number;
        fields: FieldDef[];
        packed: boolean;
        create(values?: FieldsInput<F>): Buffer;
        get<K extends string>(buf: Buffer, fieldName: K): FieldValue<F, K>;
        set<K extends string>(
            buf: Buffer,
            fieldName: K,
            value: FieldArg<F, K>,
        ): void;
        toObject(buf: Buffer): FieldsObject<F>;
        getNestedBuffer(buf: Buffer, fieldName: string): Buffer;
        isUnion: true;
    }

    Type Parameters

    • F extends Record<string, FieldSpec> = Record<string, any>

    Hierarchy (View Summary)

    Index
    size: number

    Total size of the struct in bytes.

    alignment: number

    Alignment requirement in bytes.

    fields: FieldDef[]

    Field definitions.

    packed: boolean

    Whether the struct is packed (no padding).

    isUnion: true
    • Write a field value to a buffer.

      Type Parameters

      • K extends string

      Parameters

      Returns void

    • Get a view of a nested struct's buffer region.

      Parameters

      • buf: Buffer
      • fieldName: string

      Returns Buffer