News for hackers. Stuff that matters.
Re:Back to old tricks, or, baby steps in Rust by dochtman on Saturday July 04, 2020 @04:49PM (#23734823)
Stream is a struct (a type with named fields). It has three parameters, the lifetime s, the type S and the type A. S must satisfy the Seed trait, and A must satisfy the Copy trait. Stream has two fields, next and seed. The type of next is a Box (basically an owned pointer into the heap) of a type that implements the Fn(S) -> Step<S, A> interface (that is, it can be called with an S as the single argument and produces something of the type Step parametrized with S and A) and does not outlive the s lifetime. The field seed is of the type S.

This chapter of the book is probably a good start:

https://doc.rust-lang.org/book/ch10-00-generics.html

Re:Back to old tricks, or, baby steps in Rust by partiallattice on Sunday July 05, 2020 @01:27PM (#23740309)
Small typo:

it can be called with an S as the single argument and produces something of the type Step parametrized with S and A) and -does not- outlives the s lifetime.

's refers to a minimal lifetime and not a maximal limit.