pub struct Preferences;Expand description
Provides operations for reading, writing, deleting, and managing macOS plist preference files in user or global domains.
Implementations§
Source§impl Preferences
impl Preferences
Sourcepub fn list_domains() -> Result<HashSet<Domain>>
pub fn list_domains() -> Result<HashSet<Domain>>
List all available domains.
Sourcepub fn find(word: &str) -> Result<HashMap<Domain, Vec<FindMatch>>>
pub fn find(word: &str) -> Result<HashMap<Domain, Vec<FindMatch>>>
Search all domains for keys or values containing the given word (case-insensitive).
Sourcepub fn read(domain: Domain, key: &str) -> Result<PrefValue>
pub fn read(domain: Domain, key: &str) -> Result<PrefValue>
Read a value from the given domain and key.
Sourcepub fn read_domain(domain: Domain) -> Result<PrefValue>
pub fn read_domain(domain: Domain) -> Result<PrefValue>
Read an entire domain.
Sourcepub fn write(domain: Domain, key: &str, value: PrefValue) -> Result<()>
pub fn write(domain: Domain, key: &str, value: PrefValue) -> Result<()>
Write a value to the given domain and key.
If the domain file does not exist, it will be created. If the key already exists, its value will be overwritten.
Sourcepub fn delete_domain(domain: Domain) -> Result<()>
pub fn delete_domain(domain: Domain) -> Result<()>
Delete a whole domain.
Sourcepub fn read_type(domain: Domain, key: &str) -> Result<String>
pub fn read_type(domain: Domain, key: &str) -> Result<String>
Read the type of a value at the given key in the specified domain.
Returns a string describing the type.
Sourcepub fn rename(domain: Domain, old_key: &str, new_key: &str) -> Result<()>
pub fn rename(domain: Domain, old_key: &str, new_key: &str) -> Result<()>
Rename a key in the given domain.
Moves the value from old_key to new_key within the domain plist.
Auto Trait Implementations§
impl Freeze for Preferences
impl RefUnwindSafe for Preferences
impl Send for Preferences
impl Sync for Preferences
impl Unpin for Preferences
impl UnwindSafe for Preferences
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more