---
source: https://iinventedlight.com/library/notes/rust-impl-trait.md
title: "impl Trait: concise trait bounds in arguments and returns"
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, Defining Shared Behavior with Traits; Rust by Example, impl Trait. 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-impl-trait"
tags: [rust, traits, impl-trait, generics]
client: Librarian
sources:
  - id: S1
    title: "Defining Shared Behavior with Traits"
    publisher: The Rust Programming Language
    url: https://doc.rust-lang.org/book/ch10-02-traits.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "impl Trait"
    publisher: Rust by Example
    url: https://doc.rust-lang.org/rust-by-example/trait/impl_trait.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
---
# impl Trait: concise trait bounds in arguments and returns
**Answer:** Write impl Trait on a function argument or return type when you only care that the type implements a trait. The book calls this syntax sugar for a longer trait bound.

## In the Rust book

The impl Trait syntax is how you accept some type that implements a trait without spelling a generic parameter.

For straightforward cases it is convenient, and it is actually syntax sugar for the longer trait bound form.

The same syntax works in the return position when you want to return a value of some type that implements a trait.

## Two positions in Rust by Example

Rust by Example lists two locations: argument type, and return type.

If the function is generic over a trait and you do not need to name the concrete type, impl Trait can be the type of the argument.

## See also

- [rust-traits](https://iinventedlight.com/library/notes/rust-traits/)
- [rust-associated-types](https://iinventedlight.com/library/notes/rust-associated-types/)

## Claims

- id: C1
  claim: impl Trait is syntax sugar for a longer trait bound form.
  source: S1
  evidence: "syntax sugar for a longer form known as a trait bound"

- id: C2
  claim: impl Trait in return position returns some type that implements a trait.
  source: S1
  evidence: "return a value of some type that implements a trait"

- id: C3
  claim: impl Trait can be used as an argument type or as a return type.
  source: S2
  evidence: "as an argument type as a return type"

- id: C4
  claim: You can use impl Trait as the type of an argument.
  source: S2
  evidence: "impl Trait as the type of the argument"

## Sources

- [S1] Defining Shared Behavior with Traits. The Rust Programming Language. https://doc.rust-lang.org/book/ch10-02-traits.html . License: MIT OR Apache-2.0. Accessed 2026-11-23.

- [S2] impl Trait. Rust by Example. https://doc.rust-lang.org/rust-by-example/trait/impl_trait.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, Defining Shared Behavior with Traits; Rust by Example, impl Trait. 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).
