specs icon indicating copy to clipboard operation
specs copied to clipboard

Add way of getting multiple mutable references from storages

Open WaDelma opened this issue 7 years ago • 13 comments

Add API that allows getting multiple mutable references from a storage in a way that preserves correctness. If we had integer generics we could provide generic API:

fn get_muts<const N: usize>(&mut self, [Entity; N]) -> Option<[&mut T; N]>;

Right now we could provide more specific instances of it.

The API should be restricted to DistinctStorages and should check that parameter indices are different.

WaDelma avatar Jan 12 '18 00:01 WaDelma

Should we also add API for getting multiple entries?

WaDelma avatar Jan 12 '18 00:01 WaDelma

Actually, DistinctStorage is one part of the API that I'm not so sure about. We don't know if in the future Rust still permits this hack.

torkleyy avatar Jan 13 '18 11:01 torkleyy

That would be shame.. It would basically destroy any chance of reusing any storages for parallel iteration.

WaDelma avatar Jan 13 '18 14:01 WaDelma

Well, I think we could still make it work with VecStorage and DenseVecStorage.

torkleyy avatar Jan 13 '18 14:01 torkleyy

@mjadczak May I add your source code (the roboter following the other one) here so that we have a real-world example?

torkleyy avatar May 22 '18 06:05 torkleyy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Feel free to comment if this is still relevant.

stale[bot] avatar Mar 30 '19 09:03 stale[bot]

Hey @torkleyy , I hadn't noticed your comment until now. I don't know if this is still relevant / helpful, but the relevant code is here - I have to collect up all the changes I want to apply and only then apply them.

mjadczak avatar Mar 30 '19 11:03 mjadczak

Thanks @mjadczak! I'm still looking for a good solution here.

torkleyy avatar Mar 31 '19 05:03 torkleyy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Feel free to comment if this is still relevant.

stale[bot] avatar May 30 '19 05:05 stale[bot]

Commenting to keep open (presumably hasn't been solved yet)

mjadczak avatar Jun 03 '19 15:06 mjadczak

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Feel free to comment if this is still relevant.

stale[bot] avatar Aug 02 '19 15:08 stale[bot]

Ditto?

OvermindDL1 avatar Aug 02 '19 15:08 OvermindDL1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Feel free to comment if this is still relevant.

stale[bot] avatar Oct 01 '19 16:10 stale[bot]