# struct

{% dynamic setvar source_file "src/main/java/com/google/devtools/build/lib/starlarkbuildapi/core/StructApi.java" %} {% dynamic setvar version "8.2.0" %} {% dynamic setvar original_path "/rules/lib/builtins/struct" %} {% include "_buttons.html" %} A generic object with fields.

Structs fields cannot be reassigned once the struct is created. Two structs are equal if they have the same fields and if corresponding field values are equal.

## Members

- struct

## struct

    struct struct(**kwargs)

Creates an immutable struct using the keyword arguments as attributes. It is used to group multiple values together. Example:

    s = struct(x = 2, y = 3)
    return s.x + getattr(s, "y")  # returns 5

### Parameters

Parameter | Description
--- | ---
`kwargs` | default is `{}` Dictionary of arguments.