]> git.lizzy.rs Git - rust.git/commitdiff
Expand further on <> syntax in TRPL.
authorSteve Klabnik <steve@steveklabnik.com>
Wed, 5 Aug 2015 17:23:22 +0000 (13:23 -0400)
committerSteve Klabnik <steve@steveklabnik.com>
Wed, 5 Aug 2015 17:23:22 +0000 (13:23 -0400)
We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.

Fixes #26917

src/doc/trpl/lifetimes.md

index 8e02367b921bc185eba4ff5fb12ca54fed57910c..bdb22fb4a690672b51a6c05d3701a1f16d97ce97 100644 (file)
@@ -77,8 +77,18 @@ Before we get to that, though, let’s break the explicit example down:
 fn bar<'a>(...)
 ```
 
-This part declares our lifetimes. This says that `bar` has one lifetime, `'a`.
-If we had two reference parameters, it would look like this:
+We previously talked a little about [function syntax][functions], but we didn’t
+discuss the `<>`s after a function’s name. A function can have ‘generic
+parameters’ between the `<>`s, of which lifetimes are one kind. We’ll discuss
+other kinds of generics [later in the book][generics], but for now, let’s
+just focus on the lifteimes aspect.
+
+[functions]: functions.html
+[generics]: generics.html
+
+We use `<>` to declare our lifetimes. This says that `bar` has one lifetime,
+`'a`. If we had two reference parameters, it would look like this:
+
 
 ```rust,ignore
 fn bar<'a, 'b>(...)