Skip to content
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

How to check disposition #21

Closed
kgv opened this issue Nov 14, 2018 · 1 comment
Closed

How to check disposition #21

kgv opened this issue Nov 14, 2018 · 1 comment

Comments

@kgv
Copy link

kgv commented Nov 14, 2018

How to check "disposition" after create key with create_subkey?
Maybe return enum Disposition { Created(RegKey), Opened(RegKey) }?

@gentoo90
Copy link
Owner

What time is it? Time to break some API.
Version 0.6.0 released.

create_subkey, create_subkey_with_flags, create_subkey_transacted and create_subkey_transacted_with_flags now return a tuple which contains the subkey and its disposition which can be REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY

e.g.

let (key, disp) = hkcu.create_subkey(&path)?;

which is more ergonomic than
enum Disposition { Created(RegKey), Opened(RegKey) } because users who aren't interested in disposition can just ignore it:

let (key, _) = hkcu.create_subkey(&path)?;

while with your variant they would be forced to use match to get to the key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants