gentoo90/winreg-rs

How to check disposition

kgv opened this issue · 1 comments

kgv commented

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

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