You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mulkieran While working on #2355, I noticed that a lot of our destroy methods take &mut self. Would it make more sense here to use self and let Rust's ownership checking guarantee that the entity can't be used after it's destroyed? I need to at least change this for the crypt layer as I've tried to make the code simpler by guaranteeing that if you have a CryptHandle, the device is active. However, I'm wondering if this would add a benefit across our code base.
The text was updated successfully, but these errors were encountered:
I think taking self is actually a bad idea just because of the fallible nature of the teardown methods. I'd almost rather still take &mut self but create a new data type to mark a layer as deactivated so that it can't be accessed afterwards. I think this is a larger and longer term redesign so I'm going to put this to the side for now.
jbaublitz
changed the title
Should our destroy methods take self instead of &mut self?
Destroy and teardown should somehow mark layers of the stack as torn down on success
Mar 23, 2023
@mulkieran While working on #2355, I noticed that a lot of our destroy methods take
&mut self
. Would it make more sense here to useself
and let Rust's ownership checking guarantee that the entity can't be used after it's destroyed? I need to at least change this for thecrypt
layer as I've tried to make the code simpler by guaranteeing that if you have aCryptHandle
, the device is active. However, I'm wondering if this would add a benefit across our code base.The text was updated successfully, but these errors were encountered: