Skip to content

Explain the <> more, in or before the Lifetimes chapter of TRPL where it first appears #26917

@carols10cents

Description

@carols10cents

Some feedback from reddit:

Also, the functionsyntax hadn't come up previously [to the Lifetimes chapter], so it would be nice to expand on that.

The Lifetimes chapter currently has:

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:

fn bar<'a, 'b>(...)

Then in our parameter list, we use the lifetimes we’ve named:

which does say "declares our lifetimes", so maybe further explanation isn't appropriate here, but it looks like the Functions chapter is sticking to the bare minimum.

I'm not sure where this would fit, but I think the < > could use another sentence or two of explanation-- "This is where you declare lifetime and generic type parameters that this function is going to use" and link to the appropriate chapters for that perhaps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions