Comments (4)
I feel like for safety aspects I should check with @Manishearth, but the intention is that ChunkyVec
is mostly push only. I copied this from the elsa
types.
Since the storage for ChunkyVec
is chunked, and not a Vec
, it should be okay to replace items already allocated as well as supporting pop
. removeSources()
in L10nRegistry.jsm might be a bit hard to implement given the constraints. This is where the elsa
types keep the element boxed so it's address is stable and it's possible to then re-arrange the underlying Vec
.
Alternatively, is it possible to store Option<T>
in the ChunkyVec
? Removal would then None
the element and source checking logic would need to skip those.
WDYT, @zbraniecki?
from chunky-vec.
Using Option
would mean that for i in 0..10 { registerSource;removeSource;}
would result in 10 element ChunkyVec with empty elements.
I'd prefer to avoid that if possible.
Do you think that this is the best we can do with ChunkyVec
?
from chunky-vec.
Do you think that this is the best we can do with
ChunkyVec
?
At the moment, unfortunately, yes, with out adding logic inside ChunkyVec
so that it becomes more like slab
.
Would it be possible to add the add/remove functionality into a thin wrapper over ChunkyVec<Option<T>>
type in L10nRegistry? (Or can we add impl
s only for ChunkyVec<Option<T>>
? I'd be open to that, unless someone with more Rust soundness experience tells me it's wrong)
from chunky-vec.
Yeah append-only collections have a lot of good properties for performance and safety, deletion makes it harder. slab
is indeed a good option here
Thin wrapper is another.
from chunky-vec.
Related Issues (2)
- Ecosystem fit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chunky-vec.