Struct windows_registry::Key
source · pub struct Key(/* private fields */);
Expand description
A registry key.
Implementations§
source§impl Key
impl Key
sourcepub fn create<T: AsRef<str>>(&self, path: T) -> Result<Self>
pub fn create<T: AsRef<str>>(&self, path: T) -> Result<Self>
Creates a registry key. If the key already exists, the function opens it.
sourcepub unsafe fn from_raw(handle: *mut c_void) -> Self
pub unsafe fn from_raw(handle: *mut c_void) -> Self
Constructs a registry key from an existing handle.
§Safety
This function takes ownership of the handle.
The handle must be owned by the caller and safe to free with RegCloseKey
.
sourcepub fn remove_tree<T: AsRef<str>>(&self, path: T) -> Result<()>
pub fn remove_tree<T: AsRef<str>>(&self, path: T) -> Result<()>
Removes the registry keys and values of the specified key recursively.
sourcepub fn keys(&self) -> Result<KeyIterator<'_>>
pub fn keys(&self) -> Result<KeyIterator<'_>>
Creates an iterator of registry key names.
sourcepub fn values(&self) -> Result<ValueIterator<'_>>
pub fn values(&self) -> Result<ValueIterator<'_>>
Creates an iterator of registry values.
sourcepub fn set_u32<T: AsRef<str>>(&self, name: T, value: u32) -> Result<()>
pub fn set_u32<T: AsRef<str>>(&self, name: T, value: u32) -> Result<()>
Sets the name and value in the registry key.
sourcepub fn set_u64<T: AsRef<str>>(&self, name: T, value: u64) -> Result<()>
pub fn set_u64<T: AsRef<str>>(&self, name: T, value: u64) -> Result<()>
Sets the name and value in the registry key.
sourcepub fn set_string<T: AsRef<str>>(&self, name: T, value: T) -> Result<()>
pub fn set_string<T: AsRef<str>>(&self, name: T, value: T) -> Result<()>
Sets the name and value in the registry key.
sourcepub fn set_hstring<T: AsRef<str>>(&self, name: T, value: &HSTRING) -> Result<()>
pub fn set_hstring<T: AsRef<str>>(&self, name: T, value: &HSTRING) -> Result<()>
Sets the name and value in the registry key.
sourcepub fn set_multi_string<T: AsRef<str>>(
&self,
name: T,
value: &[T],
) -> Result<()>
pub fn set_multi_string<T: AsRef<str>>( &self, name: T, value: &[T], ) -> Result<()>
Sets the name and value in the registry key.
sourcepub fn set_bytes<T: AsRef<str>>(&self, name: T, value: &[u8]) -> Result<()>
pub fn set_bytes<T: AsRef<str>>(&self, name: T, value: &[u8]) -> Result<()>
Sets the name and value in the registry key.
sourcepub fn get_type<T: AsRef<str>>(&self, name: T) -> Result<Type>
pub fn get_type<T: AsRef<str>>(&self, name: T) -> Result<Type>
Gets the type for the name in the registry key.
sourcepub fn get_value<T: AsRef<str>>(&self, name: T) -> Result<Value>
pub fn get_value<T: AsRef<str>>(&self, name: T) -> Result<Value>
Gets the value for the name in the registry key.
sourcepub fn get_u32<T: AsRef<str>>(&self, name: T) -> Result<u32>
pub fn get_u32<T: AsRef<str>>(&self, name: T) -> Result<u32>
Gets the value for the name in the registry key.
sourcepub fn get_u64<T: AsRef<str>>(&self, name: T) -> Result<u64>
pub fn get_u64<T: AsRef<str>>(&self, name: T) -> Result<u64>
Gets the value for the name in the registry key.
sourcepub fn get_string<T: AsRef<str>>(&self, name: T) -> Result<String>
pub fn get_string<T: AsRef<str>>(&self, name: T) -> Result<String>
Gets the value for the name in the registry key.
sourcepub fn get_hstring<T: AsRef<str>>(&self, name: T) -> Result<HSTRING>
pub fn get_hstring<T: AsRef<str>>(&self, name: T) -> Result<HSTRING>
Gets the value for the name in the registry key.