Skip to Main Content
The Rust Programming Language
book

The Rust Programming Language

by Steve Klabnik, Carol Nichols
July 2018
Intermediate to advanced content levelIntermediate to advanced
552 pages
13h 50m
English
No Starch Press
Content preview from The Rust Programming Language

5USING STRUCTS TO STRUCTURE RELATED DATA

image

A struct, or structure, is a custom data type that lets you name and package together multiple related values that make up a meaningful group. If you’re familiar with an object-oriented language, a struct is like an object’s data attributes. In this chapter, we’ll compare and contrast tuples with structs, demonstrate how to use structs, and discuss how to define methods and associated functions to specify behavior associated with a struct’s data. Structs and enums (discussed in Chapter 6) are the building blocks for creating new types in your program’s domain to take full advantage of Rust’s compile time ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming WebAssembly with Rust

Programming WebAssembly with Rust

Kevin Hoffman
Programming Rust

Programming Rust

Jim Blandy, Jason Orendorff
The Rust Programming Language, 2nd Edition

The Rust Programming Language, 2nd Edition

Steve Klabnik, Carol Nichols

Publisher Resources

ISBN: 9781492067665Errata Page