Name of a pattern?

I cannot find an article I was reading recently describing capability of rust to implement certain functionality of a type depending on a state of that type. As an example, there was a file example described how there is a open method implemented on a file that is unopen, but there isn't such method (an open method) on a closed file?
Does anyone know what I'm talking about?

Are you looking for typestate pattern?