-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul Key API #9
Comments
This commit adds
|
Commit 42c490b marks Changes to |
Commit bb2e8ee marks the other This shall guide users of |
Missing pieces:
|
Besides other things this commit adds Also during implementation we found out that So after removing this work item what is missing is implementations of |
Key API
The
Key
API as of now mainly consists ofKey::with_offset(key: Key, offset: u32) -> Key
Key::with_chunk_offset(key: Key, offset: u32) -> Key
Key::store(&mut self, bytes: &[u8])
Key::load(&self) -> Vec<u8>
Key::clear(&mut self)
Especially the
Key::with_offset
andKey::with_chunk_offset
APIs are not intuitive.A better design would be to use the
std::ops::Add
andstd::ops::AddAssign
traits and implement them foru32
(replaces uses ofKey::with_offset
),u64
(replaces uses ofKey::with_chunk_offset
) and also some versions fori32
andi64
to go in both directions.Due to technical implementation issues the unsigned variants could be implemented a bit more efficient.
For completeness one could also think about
u128
andi128
support sinceKey
is 256-bit anyway.Also
Key::store
,Key::load
andKey::clear
could be markedunsafe
since those operations are normally not safe using the rawKey
abstraction and are only made safe by the many alternatives, likeSyncCell
,Value
,Vec
, etc.The text was updated successfully, but these errors were encountered: