18

This SO answer uses a where syntax I'm unfamiliar with:

fn readfile<'a, T: ?Sized>(filename: &str) -> Result<Box<Outer<'a, T>>, Box<std::error::Error>> where for<'de> T: Deserialize<'de> + 'a { ... 

What does the for mean?

Where is this documented?

1 Answer 1

15

This is so-called higher-ranked trait bounds:

for<'a> can be read as "for all choices of 'a"

And it is defined by Rust RFC 0387.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.