Skip to main content
Bazel Documentation home page
HEAD
English
Search...
⌘K
Ask AI
Module Registry
Blog
Github
Search...
Navigation
struct
About Bazel
Getting started
User guide
Reference
Extending
Community
Concepts
Extension Overview
Writing rules
Rules Tutorial
Creating a Symbolic Macro
Creating a Legacy Macro
Using Macros to Create Custom Verbs
Starlark Language
.bzl style guide
Challenges of Writing Rules
Windows
Distributing rules
Testing
Optimizing Performance
Deploying Rules
APIs
One-Page Overview
Global functions
On this page
Members
struct
Parameters
struct
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
Copy
Ask AI
struct struct(**kwargs)
Creates an immutable struct using the keyword arguments as attributes. It is used to group multiple values together. Example:
Copy
Ask AI
s = struct(x = 2, y = 3)
return s.x + getattr(s, "y") # returns 5
Parameters
ParameterDescription
kwargs
default is
{}
Dictionary of arguments.
⌘I