-
Notifications
You must be signed in to change notification settings - Fork 34
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
storage: add StorageIterate #48
base: master
Are you sure you want to change the base?
Conversation
Two notes:
|
@jmesmon Do you still plan to work on this and address my comments? |
@ivmarkov ya, sorry about not getting back to you on this. I agree about the CStr bit (it should be removed), and seeing if I'm not sure when I'll take a look though. Might be soon or might not be. |
This allows iteration over entries within a a storage instance.
I pushed a change removing the I looked at using
I might have missed a way to go about this with |
StorageIterate
provides a way to iterate over all the keys within aStorage
instance.Some notes:
storage
instance while the iterator exists, even though this might not be needed by all implementationsResult<>
both on the initialentries()
call and on each step. This mirrors https://doc.rust-lang.org/std/fs/fn.read_dir.htmlStorageIterate::Error
type parameter makes things more flexible when layering over aStorageImpl
compared to inheriting fromStorageBase
.name()
andname_cstr()
functions on each entry. They mainly exist because on esp-idf's nvs we have cstrings as the underlying data, and I did not want to prevent obtaining entries with non-utf-8 names. In practice, it might be ok to skip non-utf-8 entries instead of allowing access to theCStr
.esp-idf-svc PR: esp-rs/esp-idf-svc#249