Types

Types

This chapter describes the type system of Rue.

Every value in Rue has a type that determines its representation in memory and the operations that can be performed on it.

Zero-Sized Types

A zero-sized type (ZST) is a type with a size of zero bytes. Zero-sized types can be instantiated and passed by value, but they occupy no storage.

The following types are zero-sized:

  • The unit type ()
  • The never type !
  • Empty structs (structs with no fields)
  • Zero-length arrays [T; 0] for any type T

Zero-sized types have an alignment of 1 byte.

In this section