Skip to content

Commit

Permalink
Implement PartialEq for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dariocurr committed Feb 20, 2024
1 parent cb74b94 commit b7f7cc7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions env-settings-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ pub enum EnvSettingsError {
NotExists(&'static str),
}

impl PartialEq for EnvSettingsError {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Convert(l0, l1, l2), Self::Convert(r0, r1, r2)) => {
l0 == r0 && l1 == r1 && l2 == r2
}
(Self::File(l0, l1), Self::File(r0, r1)) => {
l0 == r0 && l1.to_string() == r1.to_string()
}
(Self::NotExists(l0), Self::NotExists(r0)) => l0 == r0,
_ => false,
}
}
}

/// Get the environment variables
pub fn get_env_variables(case_insensitive: bool) -> collections::HashMap<String, String> {
let env_variables = env::vars();
Expand Down

0 comments on commit b7f7cc7

Please sign in to comment.