arc-swap icon indicating copy to clipboard operation
arc-swap copied to clipboard

Make types like `Box<dyn DynAccess>` implement Access

Open steffahn opened this issue 2 years ago • 7 comments

by generalizing the P: Deref-implementation to ?Sized, and implementing Access for some dyn DynAccess trait object types.

Not yet documented or polished, this PRs main purpose for now is to allow CI testing.

steffahn avatar Jul 05 '22 18:07 steffahn

The failing clippy lints are unrelated to this PR.

steffahn avatar Jul 05 '22 18:07 steffahn

Older compiler version apparently fails in one of the dependencies (half).

steffahn avatar Jul 05 '22 18:07 steffahn

Codecov Report

Merging #78 (a113002) into master (f7f192d) will increase coverage by 0.60%. The diff coverage is 33.33%.

@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
+ Coverage   83.37%   83.97%   +0.60%     
==========================================
  Files          18       18              
  Lines        1149     1161      +12     
==========================================
+ Hits          958      975      +17     
+ Misses        191      186       -5     
Impacted Files Coverage Δ
src/access.rs 86.02% <33.33%> (-7.81%) :arrow_down:
src/lib.rs 87.56% <0.00%> (+0.51%) :arrow_up:
src/strategy/hybrid.rs 93.84% <0.00%> (+6.15%) :arrow_up:
src/debt/helping.rs 89.06% <0.00%> (+10.93%) :arrow_up:

codecov-commenter avatar Jul 05 '22 18:07 codecov-commenter

@vorner I’ve addressed the unrelated CI failures (I don’t know if that’s the "proper" way to do this with the dependencies for 1.45 compilation, but it seems like it works); feel free to re-run CI.

steffahn avatar Jul 05 '22 19:07 steffahn

are there any cases left where it is necessary?

as already noted over in #77:

the actual AccessConvert is somewhat more general, as it allows – say – Box<dyn Foo> for a trait Foo: DynAccess, too.

Similarly, you can use it for things like Box<dyn DynAccess + Unpin> or Box<dyn DynAccess + Sync> or other more rare variantions on the trait object type that I didn't cover with any explicit implementation. (I chose the same selection three of auto-trait combinations (none, only send, and send+sync) that e. g. dyn Any in the standard library supports for downcasting; if there are others with practical use, they can be added later.)

steffahn avatar Jul 06 '22 13:07 steffahn

Hello again. Just wanted to check, are you still working on the docs, or did that one get lost in the rest of the discussion? 😇 Just that we both don't wait on something from the other side.

vorner avatar Jul 10 '22 15:07 vorner

Thanks for the ping. I didn’t misunderstand, but I haven’t written the docs yet either; I’ll try to allocate some time to this soon :-)

steffahn avatar Jul 10 '22 15:07 steffahn

Hello.

I've discovered this still sits here. Not that I would have too much free time myself, but should I just take it over and write the docs, so it moves forward?

vorner avatar Dec 24 '22 15:12 vorner

I forgot this PR even exists, so ehm... sure, feel free to take over, thank you.

steffahn avatar Dec 24 '22 15:12 steffahn

I've taken the main commit, put it onto current (which already had the CI issues mostly solved) master and made some docs for it and merged in #85.

I'll try to collect few more outstanding PRs and release a new version soon. If I don't get around to it by the end of the year, feel free to ping me.

Thank you for discovering the way to do this :-)

vorner avatar Dec 25 '22 10:12 vorner