prefs 0.1.2

Type-safe macOS preferences library
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::ffi::NulError;
use thiserror::Error;

/// Errors that can occur when interacting with macOS preferences.
#[derive(Debug, Error)]
pub enum Error {
    /// A string contained a null byte and could not be converted to a C string.
    #[error("string contains null byte")]
    Nul(#[from] NulError),
    /// Writing or removing a preference value failed.
    #[error("failed to write preference")]
    WriteFailed,
}

/// Shorthand for `std::result::Result<T, Error>`.
pub type Result<T> = std::result::Result<T, Error>;