pub struct ThingsConfig {
pub database_path: PathBuf,
pub fallback_to_default: bool,
}Expand description
Configuration for Things 3 database access
Fields§
§database_path: PathBufPath to the Things 3 database
fallback_to_default: boolWhether to use the default database path if the specified path doesn’t exist
Implementations§
Source§impl ThingsConfig
impl ThingsConfig
Sourcepub fn new<P: AsRef<Path>>(database_path: P, fallback_to_default: bool) -> Self
pub fn new<P: AsRef<Path>>(database_path: P, fallback_to_default: bool) -> Self
Create a new configuration with a custom database path
§Arguments
database_path- Path to the Things 3 databasefallback_to_default- Whether to fall back to the default path if the specified path doesn’t exist
Sourcepub fn with_default_path() -> Self
pub fn with_default_path() -> Self
Create a configuration with the default database path
Sourcepub fn get_effective_database_path(&self) -> Result<PathBuf>
pub fn get_effective_database_path(&self) -> Result<PathBuf>
Get the effective database path, falling back to default if needed
§Errors
Returns ThingsError::Message if neither the specified path nor the default path exists
Sourcepub fn get_default_database_path() -> PathBuf
pub fn get_default_database_path() -> PathBuf
Get the default Things 3 database path.
Delegates to crate::database::get_default_database_path, which
auto-discovers the per-install ThingsData-XXXXX suffix.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create configuration from environment variables
Reads the database path from THINGS_DB_PATH (preferred) or the legacy
THINGS_DATABASE_PATH, and the fallback flag from THINGS_FALLBACK_TO_DEFAULT.
Sourcepub fn for_testing() -> Result<Self>
pub fn for_testing() -> Result<Self>
Create configuration for testing with a temporary database
§Errors
Returns ThingsError::Io if the temporary file cannot be created
Trait Implementations§
Source§impl Clone for ThingsConfig
impl Clone for ThingsConfig
Source§fn clone(&self) -> ThingsConfig
fn clone(&self) -> ThingsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ThingsConfig
impl Debug for ThingsConfig
Auto Trait Implementations§
impl Freeze for ThingsConfig
impl RefUnwindSafe for ThingsConfig
impl Send for ThingsConfig
impl Sync for ThingsConfig
impl Unpin for ThingsConfig
impl UnsafeUnpin for ThingsConfig
impl UnwindSafe for ThingsConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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