liveBook · Manning

Concrete type

As explained in Learn Rust in a Month of Lunches

A concrete type is a specific Rust type rather than an abstract type parameter or trait description.

A concrete type is a specific Rust type, such as i32, String, or a named type. Unlike a generic type parameter, it names one definite type. Without angle brackets such as <T>, Rust treats a type name as concrete and looks for that exact type. section 5.1

Concrete and generic function inputs

The function `return_item(item: i32) -> i32` accepts only i32. Replacing the fixed type with `return_item<T>(item: T) -> T` makes the function generic, so T can represent the caller’s type. Writing `return_item(item: MyType)` instead makes Rust search for one concrete type named MyType; adding `<MyType>` declares MyType as a type parameter. section 5.1

Closures make the distinction especially clear. Every closure has its own unique concrete type, even when two closures have identical signatures. The closures implement the Fn trait, but Fn describes their behavior rather than serving as their concrete type. A function taking two parameters of one generic type therefore rejects two separately written closures; using different parameters, F and G, accepts them. section 12.1.3

How Learn Rust in a Month of Lunches covers it

How deep it goes
Defines concrete types, contrasts generic syntax, and works through closure type errors without covering boxing internals.
Examples
Uses fixed and generic return_item functions, undeclared MyType, and two identical-looking closures rejected as different types.
What it assumes
Assumes basic Rust functions and types while teaching generic angle brackets and trait-based closure bounds from their signatures.
What you can do after
Evaluate whether a Rust signature names one fixed type, introduces a generic parameter, or accepts behavior through a trait bound.
How it connects
Connects concrete types with generics, traits, closures, function signatures, and compiler type errors.

Also explained in

Compare how 3 books explain concrete type →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Rust in a Month of Lunches. The section links point to the parts of the book it draws on.