Add an internal token to all APIs that create resources #79
Add an internal token to all APIs that create resources #79albertsgarde merged 3 commits intoalbertsgarde:mainfrom
Conversation
d19a980 to
eb2dc50
Compare
|
Was is the advantage of this design over the current privacy based design? |
|
I don't think we can remove
|
|
That makes a lot of sense. Could we just make the functions that create resources unsafe directly? Feels like this would even more directly mark where we have to be careful, and should have the same advantages wrt. simplifying traits right? |
548cf60 to
2e601c8
Compare
|
Hm, that's true but you'll note that I don't require unsafe to create the token from within the engine itself. Passing the token feels more robust? We couldn't have the nice |
|
Oh wow yeah That makes sense. I guess the partial use of unsafe feels weird? That something is safe in one crate is unsafe in another? I know we're already abusing unsafe, but this feels like an unnecessary departure from (at least my impression of) how unsafe usually works. To avoid this we could expose Minor things:
|
Honestly yeah that feels fine. That still gets all the benefits of a token, I do agree it feels off to call that unsafe.
I like
Oh interesting, good point. I'll look into all that |
|
|
2e601c8 to
a6068a0
Compare
EngineToken to all APIs that create resources
This makes it explicit which parts of the game need to be careful about resource handling. Also makes it possible to remove the
FooExtraits since they were only needed to avoid making these methods available via the main game crate.The first 3 commits are from #78.