Difference Between Type and Struct

A struct is a type-- "type" is the more general category; struct is one kind of type. Other kinds of types are enums, scalar primitive types, and compound primitive types.

The core Rust language defines the primitive types and the mechanism by which new structs and enums can be created. The standard library defines more structs and enums such as String and Option<T>, and you can define your own structs and enums.

The reference has a really technical section on types that you might also be interested in.

Does that help? :slight_smile:

5 Likes