What if Rust had a new data type that supports partial field borrows?

74 points NormalAppearance2851 43 comments

So, what if we had something like a struct, but its methods borrow the fields instead of the whole thing?

AFAIK the community has asked for something like this but i've heard that

  • It's very hard to implement
  • It would break compatibility and stuff