Hacker News new | ask | show | jobs
by tialaramex 27 days ago
self.0 is the zeroth field of self,

self is the name for a value of this type, apparently a type named LexerConsumer, this function took "&mut self" a mutable reference to a LexerConsumer. In Rust using any variety of "self" in this way means the function can (if you want) be called as a method on a LexerConsumer like this:

foo.consume(); // If foo is a LexerConsumer, we will call that `consume` function and pass it a mutable reference to foo.

Presumably the LexerConsumer doesn't give its fields names, so hence self.0 meaning just the zeroth field. Perhaps the author couldn't think of a good name for it.