As long as you call .collect()
on it at the end, don’t need to write the entire type as it is a method with a generic parameter, and returns that generic.
The intermediate iterators though, those are hell. Especially if you pass it to a lambda and for some reason rust can’t infer the type.
I once came across a parsing library that did the parsing with basically just the type system. It was absolute hell to debug and build. Types of parsers would be hundreds of characters long. It would take tens of minutes to build a simple parser.
I don’t know much much time it would take to build a complex parser, since it was unable to. it reached the max type generic depth of the rust compiler, and would just refuse to compile.
I believe it was called Chomsky or Chumsky or something like that. Discovering nom
was a blessing.
Sometimes you can’t not have a god class (struct in this case). When doing UI specifically, I always end up with one.
You can try using encapsulation to reduce the amount of fields technically, but in the end it’s the same amount of information in a single god class.