struct
struct
#
Struct — named fields. Subclass Struct; the annotations are the fields.
A field named with a leading _ is hidden on disk (_metadata → .metadata).
Struct
#
Bases: CGType
A type with named fields; each subclass is a dataclass over its annotations.
Source code in capturegraph-lib/capturegraph/types/containers/struct.py
__init_subclass__(**kwargs)
#
Turn cls into a dataclass over its annotated CGType fields.
Source code in capturegraph-lib/capturegraph/types/containers/struct.py
__setattr__(name, value)
#
Assign a field; a public field write means the loaded tree no longer matches.
Source code in capturegraph-lib/capturegraph/types/containers/struct.py
load(base)
classmethod
#
The struct stored at base, one entry per field; an absent field is Missing.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in capturegraph-lib/capturegraph/types/containers/struct.py
schema()
classmethod
#
This struct's wire form: each field's schema, tagged "struct".
Source code in capturegraph-lib/capturegraph/types/containers/struct.py
store(base, value)
classmethod
#
Write each present field of value under base; a Missing field is left off.
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in capturegraph-lib/capturegraph/types/containers/struct.py
on_disk(field_name)
#
The on-disk entry name for a struct field (_metadata → .metadata).
struct_fields(struct_or_type)
#
The declared fields of a Struct value or type, name → type, as a fresh dict.
Raises:
| Type | Description |
|---|---|
TypeError
|
If the argument is not a |