aboutsummaryrefslogtreecommitdiff
path: root/mingling/src/res
diff options
context:
space:
mode:
Diffstat (limited to 'mingling/src/res')
-rw-r--r--mingling/src/res/dirs/current_dir.rs9
-rw-r--r--mingling/src/res/dirs/current_exe.rs8
-rw-r--r--mingling/src/res/dirs/home_dir.rs4
-rw-r--r--mingling/src/res/dirs/temp_dir.rs1
4 files changed, 15 insertions, 7 deletions
diff --git a/mingling/src/res/dirs/current_dir.rs b/mingling/src/res/dirs/current_dir.rs
index 54d2b05..2dd6633 100644
--- a/mingling/src/res/dirs/current_dir.rs
+++ b/mingling/src/res/dirs/current_dir.rs
@@ -23,9 +23,12 @@ pub struct ResCurrentDir {
impl ResCurrentDir {
/// Creates a new `ResCurrentDir` by querying the OS for the current working directory.
///
- /// Returns `Err` if the current directory cannot be determined (e.g., the directory has been
- /// deleted or permissions are insufficient). Unlike the `Default` implementation, this
- /// method does not panic on failure.
+ /// # Errors
+ ///
+ /// Returns an `Err` if the current directory cannot be determined (e.g., the directory has
+ /// been deleted or permissions are insufficient).
+ ///
+ /// Unlike the `Default` implementation, this method does not panic on failure.
pub fn new() -> Result<Self, std::io::Error> {
Ok(Self {
cwd: current_dir()?,
diff --git a/mingling/src/res/dirs/current_exe.rs b/mingling/src/res/dirs/current_exe.rs
index 051f380..a2afc0b 100644
--- a/mingling/src/res/dirs/current_exe.rs
+++ b/mingling/src/res/dirs/current_exe.rs
@@ -22,9 +22,11 @@ pub struct ResCurrentExe {
impl ResCurrentExe {
/// Creates a new `ResCurrentExe` by querying the OS for the current executable path.
///
- /// Returns `Err` if the executable path cannot be determined (e.g., the `/proc`
- /// filesystem is not available on Linux, or the process handle is invalid).
- /// Unlike the `Default` implementation, this method does not panic on failure.
+ /// # Errors
+ ///
+ /// Returns an [`std::io::Error`] if the OS is unable to provide the path of the
+ /// current executable. This can occur, for example, when the `/proc` filesystem
+ /// is not mounted on Linux, or when the process handle is invalid on Windows.
pub fn new() -> Result<Self, std::io::Error> {
Ok(Self {
exe: current_exe()?,
diff --git a/mingling/src/res/dirs/home_dir.rs b/mingling/src/res/dirs/home_dir.rs
index fae3055..f5908de 100644
--- a/mingling/src/res/dirs/home_dir.rs
+++ b/mingling/src/res/dirs/home_dir.rs
@@ -21,7 +21,9 @@ pub struct ResHomeDir {
impl ResHomeDir {
/// Creates a new `ResHomeDir` by querying the environment for the user's home directory.
///
- /// Returns `Err` if the home directory cannot be determined (e.g., the `HOME` or
+ /// # Errors
+ ///
+ /// Returns an error if the home directory cannot be determined (e.g., the `HOME` or
/// `USERPROFILE` environment variable is not set).
pub fn new() -> Result<Self, std::io::Error> {
let home = home_dir_env().ok_or_else(|| {
diff --git a/mingling/src/res/dirs/temp_dir.rs b/mingling/src/res/dirs/temp_dir.rs
index 343d9c7..c79a974 100644
--- a/mingling/src/res/dirs/temp_dir.rs
+++ b/mingling/src/res/dirs/temp_dir.rs
@@ -21,6 +21,7 @@ impl ResTempDir {
///
/// This method is infallible since `std::env::temp_dir()` always succeeds,
/// returning a platform-specific default when environment variables are unset.
+ #[must_use]
pub fn new() -> Self {
Self { tmp: temp_dir() }
}