liveBook · Manning

Struct

Also called Structures

A struct is a named composite type or data structure that groups multiple fields or values into one structured unit.

How 16 Manning books explain it

Go in Practice, Second Edition

A struct is a composite Go type that groups named or anonymous fields into a single value.

How it is used
Represents known application data, including configuration and JSON responses, while providing a type to which behavior can be attached.
How deep it goes
Works through fields, anonymous structs, tags, methods, JSON mapping, and runtime inspection rather than stopping at a syntax definition.
Examples
Uses an inline struct, JSON-encoded data, a configuration file, interface-implementing types, and a recursive field walker.
What you can do after
Build it from scratch to model known data, map JSON fields, and add methods; diagnose/debug with reflection when fields need runtime inspection.

Read how Go in Practice, Second Edition explains struct →

Kafka Streams in Action, Second Edition

Struct is a Kafka Connect data structure that stores record field values together with schema-defined type information.

How it is used
Carries schema-backed Kafka Connect record values and models nested ksqlDB event fields.
How deep it goes
Explains construction, field copying, schema caching, nested declarations, and dereferencing without detailing serialization internals.
Examples
Uses stock-ticker SourceRecords, selected-field transformations, and a nested school-event JSON schema.
What you can do after
Build it from scratch as a schema-backed Connect value or declare and query nested ksqlDB fields.

Read how Kafka Streams in Action, Second Edition explains struct →

High Performance Unity Game Development

A value-type language construct that groups related data fields and may define associated behavior.

How it is used
Uses structs to store small, related game values while arranging enemy data for locality and efficient updates.
How deep it goes
Explains selection guidelines, storage location, copying, and ref-based mutation through C# examples, without prescribing structs for every workload.
Examples
Uses Unity Vector2 positions, enemy-data arrays, temporary random positions, and player movement functions.
What you can do after
Apply structs to suitable game values and use ref or reassignment when a function must change an original value.

Read how High Performance Unity Game Development explains struct →

Elixir in Action, Third Edition

An Elixir struct is a map-like data structure associated with a module and containing a defined set of fields.

How it is used
Uses structs to define precise data abstractions, distinguish instances from plain maps, and organize module functions around them.
How deep it goes
Explains definition, construction, access, pattern matching, updating, internal map behavior, and selected failure modes.
Examples
Demonstrates Fraction arithmetic and a TodoList that assigns incremental IDs while storing entries by ID.
What you can do after
Builds module-backed data abstractions with defined fields, pattern-matched operations, and immutable updates.

Read how Elixir in Action, Third Edition explains struct →

Modern C

How it is used
Uses structures to organize named values when array positions would be ambiguous or member types differ.
How deep it goes
Explains declarations, designated initializers, member access, nested structures, value passing and pointer access through examples.
Examples
Uses bird-name records, calendar times, time differences and rational-number functions to illustrate structures.
What you can do after
Build structures from scratch and use named members, designated initializers and structure pointers in C functions.

Read how Modern C explains struct →

Refactoring to Rust

A struct is a Rust composite type that groups named fields into a single logical value and can have associated functionality.

How it is used
Models logical values and structured data for JSON parsing and search-result feeds.
How deep it goes
Defines fields and construction, then works through moves, derived traits, parsing errors, and nested structures.
Examples
Uses an artwork, a JSON record, and a nested feed of entries and authors.
What you can do after
Builds structs from scratch and applies them with Serde to parse structured data.

Read how Refactoring to Rust explains struct →

DuckDB in Action

A struct is a named-field data structure in which each field has a defined data type.

How it is used
Uses structs to represent nested records and simplify complex-data preparation in analytical SQL workflows.
How deep it goes
Explains definitions, inferred schemas, unnesting, whole-STRUCT casts, field expansion, and aggregation, without detailing internal storage.
Examples
Demonstrates Premier League shot JSON, inferred STRUCT arrays, explicit casts, flattened views, and expected-goals aggregation.
What you can do after
Apply structs in DuckDB SQL to inspect, normalize, flatten, and aggregate nested JSON records.

Read how DuckDB in Action explains struct →

Learn Rust in a Month of Lunches

How it is used
Uses structs to build custom Rust types that group related values and represent selected JSON response properties.
How deep it goes
Explains unit, tuple, and named struct declarations, construction, field access, methods, and derived debugging.
Examples
Uses color and country structs, an animal with methods, and a JSON article response.
What you can do after
Build structs from scratch, initialize their fields, and attach methods or associated functions.

Read how Learn Rust in a Month of Lunches explains struct →

Julia as a Second Language

The struct keyword is Julia syntax for defining a composite type.

How it is used
Models application objects and combines them into larger data structures.
How deep it goes
Explains field definitions, construction, mutability, subtyping, and JIT implications, using pseudocode only for a rough performance intuition.
Examples
Defines game warriors and a rocket assembled from payload, tank, and engine objects.
What you can do after
Build composite types from scratch, create instances, and access their fields.

Read how Julia as a Second Language explains struct →

Go in Action, Second Edition

The struct keyword introduces a Go struct type declaration.

How it is used
Uses structs to group related data and model domain entities as reusable Go types.
How deep it goes
Explains declarations, literals, field access and visibility, then applies structs in a composed recipe model.
Examples
Uses person records and recipe measurements to illustrate reusable struct types and domain modeling.
What you can do after
Builds named struct types from scratch and uses their fields to represent domain data.

Read how Go in Action, Second Edition explains struct →

Modern C, Third Edition

The struct keyword introduces or refers to a C structure type through its structure tag.

How it is used
Organizes related values under named fields when array positions are ambiguous or member types differ.
How deep it goes
Explains declarations, objects, member access, heterogeneous fields, nesting, and visibility, while deferring detailed layout and padding treatment.
Examples
Uses bird records, calendar timestamps, nanosecond timestamps, nested person data, and a timespec difference exercise.
What you can do after
Apply C structure declarations, designated initializers, dot notation, heterogeneous fields, and nested member organization.

Read how Modern C, Third Edition explains struct →

Learn Go with Pocket-Sized Projects

A struct is a Go composite data type that groups named fields of potentially different types into one value.

How it is used
Organizes related inputs, expected results, and decoded JSON records into reusable Go values.
How deep it goes
Demonstrates declarations, nested slices, JSON tags, and decoding, but does not descend into runtime internals.
Examples
Uses testCase scenarios and Bookworm–Book records as concrete struct examples.
What you can do after
Apply it via encoding/json to represent and decode structured records, or organize reusable table-driven test cases.

Read how Learn Go with Pocket-Sized Projects explains struct →

Clojure: The Essential Reference

A Clojure struct is a map-like data structure with a defined set of keys and structural constraints.

How it is used
Creates many similarly shaped map-like values while avoiding repeated key declarations at each construction site.
How deep it goes
Defines the construction API and key constraints, then works through positional input, varying keys, accessors, equality, and exceptions.
Examples
Uses waypoint rows and coordinate maps to demonstrate positional construction, missing defined keys, extra keys, and accessor lookup.
What you can do after
Build it from scratch with create-struct or defstruct, then construct and query instances while respecting defined-key constraints.

Read how Clojure: The Essential Reference explains struct →

Code Like a Pro in Rust

A compound type is a type formed by combining or grouping multiple values or component types.

How it is used
Uses structs to encapsulate state and implement methods behind an API.
How deep it goes
Explains struct forms, visibility, methods, and C compatibility, while deferring detailed generics coverage.
Examples
Illustrates tuple-field access, mixed field visibility, a mutable method, and a zlib-compatible struct.
What you can do after
Build it from scratch: Define structs with controlled field visibility and methods, and model a C struct for FFI.

Read how Code Like a Pro in Rust explains struct →

Rust in Action: Systems programming concepts and techniques

A struct is a Rust data structure that defines a composite value with named fields and their types.

How it is used
Models related values as one entity, especially files represented by names and byte data.
How deep it goes
Defines fields, instances, borrowing, memory composition, and constructors, while deferring persistent storage and detailed pointer explanations.
Examples
Uses File values containing String names and Vec<u8> data, simulated open/read/close operations, and File::new constructors.
What you can do after
Build it from scratch by defining structs, constructing instances, borrowing fields, and adding constructors or methods.

Read how Rust in Action: Systems programming concepts and techniques explains struct →

Systems Programming with Zig

A struct is a composite type that groups named fields and can also contain associated declarations or functions.

How it is used
Packages related values and organizes declarations into namespaces in Zig programs.
How deep it goes
Explains fields, initialization, access, and namespaces, while deferring further comptime capabilities.
Examples
Uses a two-coordinate Point and a namespace containing animal-noise functions.
What you can do after
Apply structs to group values, access fields, and organize functions under a namespace.

Read how Systems Programming with Zig explains struct →

Also covered in

What to know first

Related concepts

Questions about struct

What is struct?

A struct is a named composite type or data structure that groups multiple fields or values into one structured unit.

Which Manning books explain struct?

Go in Practice, Second Edition, Kafka Streams in Action, Second Edition, High Performance Unity Game Development, Elixir in Action, Third Edition, Modern C, Refactoring to Rust, DuckDB in Action, Learn Rust in a Month of Lunches and 8 more.

What should I know before learning struct?

Manning books that teach struct usually introduce JSON, Map, array and attribute first.

What is the difference between struct and class?

A struct is a named composite type or data structure that groups multiple fields or values into one structured unit. A class is a programming-language construct that defines a type’s structure and behavior and provides a basis for creating or representing objects.

What kinds of struct are there?

Kinds of struct include arguments struct.

What is struct a kind of?

Struct is a kind of data structure. A data structure is an organized representation of data and its relationships that supports defined operations for storing, accessing, or modifying it.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.