News for hackers. Stuff that matters.
Re:Learning Parser Combinators with Rust by e12e on Friday April 19, 2019 @10:46AM (#19700035)
Thank you, yes.

Is there a binding between the "top" pointer &mut T, and the string which the pointer/length pair points to?

Can we change our pointer to point somewhere else entirely, say a newly allocated string "goodbye, world"?

  p1
   \------\
           V
  (p2, 11) (p3, 13)
  |          \
  |           \
  |            \
  V             V
  Hello World   Goodbye World
Re:Learning Parser Combinators with Rust by steveklabnik on Friday April 19, 2019 @11:02AM (#19700158)
There's no inherent connection; you could absolutely do this.
Re:Learning Parser Combinators with Rust by russed on Friday April 19, 2019 @12:56PM (#19701049)
To restrict in the manner that the person above described would require some kind of const parameter in the type, no? The type would need to be parameterized over the `&str` to ensure that slices could only be taken from that particular string.
Re:Learning Parser Combinators with Rust by steveklabnik on Friday April 19, 2019 @01:17PM (#19701225)
I believe that’s correct.