JRRudy1 / transient

Rust crate providing a reimplementation of the `std::any::Any` trait that supports types with non-`'static` lifetimes.
Other
35 stars 1 forks source link

Add associated transience types #8

Closed the10thWiz closed 3 months ago

the10thWiz commented 3 months ago
JRRudy1 commented 3 months ago

I actually added those same associated types in my local branch haha (although I called the Invariant type Frozen). I also added a couple things around it as well though, so let me merge it all together.

JRRudy1 commented 3 months ago

I added the type aliases that I mentioned in #5 to this PR. I also made the Transience trait unsafe instead of sealed, but could easily be convinced to revert that if you think think sealing it is the better option.

My general opinion towards sealing/unsafe is to let users make unsafe decisions at their own risk instead of drawing a hard line that is impossible to cross, largely inspired by my own frustrations when working with libraries where a piece of functionality I want to use is sealed or pub(crate). The main motivation I see for sealing should be when you want the freedom to change something without breaking SemVer, and I don't see that being a concern in this case but may be overlooking something.

JRRudy1 commented 3 months ago

I'm going to go ahead and merge this, but I'd be happy to continue the discussion on sealing the Transience trait if you think we should revert it.