---
source: https://iinventedlight.com/library/notes/rust-generics.md
title: "Rust generics: one definition, many concrete types"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (The Rust Programming Language); MIT OR Apache-2.0 (Rust by Example); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: The Rust Programming Language, Generic Data Types; Rust by Example, Generics. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust-by-example/master/LICENSE-MIT). Copyright the Rust Project Developers."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: rust-generics"
tags: [rust, generics, types, systems]
client: Librarian
sources:
  - id: S1
    title: "Generic Data Types"
    publisher: The Rust Programming Language
    url: https://doc.rust-lang.org/book/ch10-01-syntax.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "Generics"
    publisher: Rust by Example
    url: https://doc.rust-lang.org/rust-by-example/generics.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
---
# Rust generics: one definition, many concrete types
**Answer:** Generics let you write one function or struct definition and then use it with many different concrete data types. The usual type parameter name is T, written in angle brackets.

## Why the book introduces them

The book uses generics to create definitions for items such as function signatures or structs.

Those definitions can then be reused with many concrete types.

In a function, the generics go in the signature, where you would usually specify the data types of the parameters and the return value.

The result is more flexible code and less duplication.

## Type parameters

Rust by Example treats generics as a way of generalizing types and functionalities to broader cases.

A type parameter is marked generic with angle brackets. <T> is the typical form.

Any type specified as a generic type parameter is generic. Everything else is concrete, or non-generic.

## See also

- [rust-hashmap](https://iinventedlight.com/library/notes/rust-hashmap/)
- [rust-string-vs-str](https://iinventedlight.com/library/notes/rust-string-vs-str/)
- [rust-ownership-borrowing](https://iinventedlight.com/library/notes/rust-ownership-borrowing/)

## Claims

- id: C1
  claim: Generics create definitions you can use with many concrete data types.
  source: S1
  evidence: "use with many different concrete data types"

- id: C2
  claim: In a function, you place the generics in the signature where types usually go.
  source: S1
  evidence: "place the generics in the signature of the function"

- id: C3
  claim: Generics generalize types and functionalities to broader cases.
  source: S2
  evidence: "generalizing types and functionalities to broader cases"

- id: C4
  claim: A type parameter is specified with angle brackets, often written <T>.
  source: S2
  evidence: "specified as generic by the use of angle brackets"

## Sources

- [S1] Generic Data Types. The Rust Programming Language. https://doc.rust-lang.org/book/ch10-01-syntax.html . License: MIT OR Apache-2.0. Accessed 2026-11-23.

- [S2] Generics. Rust by Example. https://doc.rust-lang.org/rust-by-example/generics.html . License: MIT OR Apache-2.0. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Rust Programming Language, Generic Data Types; Rust by Example, Generics. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust-by-example/master/LICENSE-MIT). Copyright the Rust Project Developers. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
