Skip to content

Glossary: Rust Beyond the Basics

impl Trait

Also written: &impl Trait, impl Fn

Syntax meaning "any type that implements this trait", as in `fn postage(item: &impl Shippable)` or a returned `impl Fn(u32) -> u32`. It is a shorthand for a generic with a trait bound.

Where the book teaches it

Related terms

trait boundstatic dispatchgeneric