Rollup merge of #27538 - steveklabnik:gh26917, r=Gankro

We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.

Fixes #26917
This commit is contained in:
Steve Klabnik 2015-08-05 15:09:50 -04:00
commit 43451bc4ee

View file

@ -77,8 +77,18 @@ Before we get to that, though, lets 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 didnt
discuss the `<>`s after a functions name. A function can have generic
parameters between the `<>`s, of which lifetimes are one kind. Well discuss
other kinds of generics [later in the book][generics], but for now, lets
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>(...)